Untitled
unknown
plain_text
2 years ago
698 B
4
Indexable
describe('AppStateService', () => { let service: AppStateService; let mockLocation: any; beforeEach(() => { mockLocation = { pathname: '/safety' }; TestBed.configureTestingModule({ providers: [ AppStateService, { provide: Location, useValue: mockLocation } ] }); service = TestBed.inject(AppStateService); }); it('should return 1 if location pathname includes "safety"', () => { const result = service.abc(); expect(result).toEqual(1); }); it('should return 2 if location pathname does not include "safety"', () => { mockLocation.pathname = '/other'; const result = service.abc(); expect(result).toEqual(2); }); });
Editor is loading...