I am working on an Angular2 / TypeScript project and using jasmine for unit testing.
How to check a function that is called with a constant using jasmine. For instance. Logo.ts
export const RADIUS: number = 10; export class Logo { ... protected drawCircle( x: number, y: number, r: number ){...} protected drawLogo(){ this.drawCircle( RADIUS, RADIUS, RADIUS ); } ... }
Logo.spec.ts
describe('drawLogo', function () { beforeEach(() => { spyOn( logo, 'drawCircle'); } it('should call drawCircle method with parameters'){ expect( logo.drawCircle ).toHaveBeenCalledWith( 10, 10, 10 );
Is there any other way to check other than passing a constant as a parameter to the toHaveBeenCalledWith method?
source share