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

NGRX or how to write a little less selectors

React component structures.

Understanding the Sliding Window Technique in Algorithms

Comparing Vue js and Angular by building a same application in both the frameworks

Learning ML

Javascript reactivity explained simple

The Road To Developing A Blockchain Application

Using Material-UI with React Hook Form is this simple

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

Basics of Unit Testing in Angular

How to Test Chart.js in an Angular Component

Synchronize Data Grid state with the URL (Angular, ngqp, DevExtreme)

Integration of Bootstrap UI Framework in the Angular Application