Unit Testing in Angular — Jasmine & Karma

function PrintHello() {
return ‘Hello!’;
}
describe (‘Print Hello’, () => {(1)it (‘says hello’, () => { (2)expect (PrintHello ()) (3). toEqual (‘Hello!’); (4)});});
Prebuilt Matches in Jasmine
describe (‘Print Hello’, () => {let expected = “”;beforeEach (() => {expected = “Hello!”;});afterEach (() => {expected = “”;});it (‘says hello’, () => {expect (PrintHello ()). toEqual (expected);});});

--

--

--

Technical Speaker | Computer Engineer | Full Stack Web Developer | ML Enthusiast | * Knowledge Shared = Knowledge² *

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using VR controllers and locomotion in THREE.js

Over 2.1K Free Brand SVG Icons for Svelte

Handling Scroll Based Animation in React / Animate Image zoom-in on scroll up and zoom-out on…

Testing with Jest and Enzyme in React — Part 4 (shallow vs. mount in Enzyme)

Quickly generate html & css tags with Emmet in VSCode

The Little React Quirk I Wish I’d Known Sooner

Django, Ajax, Popover & Chartjs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vaibhav Bhapkar

Vaibhav Bhapkar

Technical Speaker | Computer Engineer | Full Stack Web Developer | ML Enthusiast | * Knowledge Shared = Knowledge² *

More from Medium

🔑Auth0 in Angular : [Part1]Authenticate your Angular app

I have created component server display.

Angular: Unit Tests with Karma & Jasmine — Attribute Directive

Angular Error Interceptor