Skip to content

Commit

Permalink
121787: fix spec issues after changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Vannerum committed Dec 16, 2024
1 parent 939f864 commit 6c1a2f2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/app/menu.resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import { ConfigurationDataServiceStub } from './shared/testing/configuration-dat
import { MenuServiceStub } from './shared/testing/menu-service.stub';
import { createPaginatedList } from './shared/testing/utils.test';
import createSpy = jasmine.createSpy;
import { AuthService } from './core/auth/auth.service';
import { MenuResolverService } from './menu-resolver.service';
import { AuthServiceStub } from './shared/testing/auth-service.stub';

const BOOLEAN = { t: true, f: false };
const MENU_STATE = {
Expand Down Expand Up @@ -80,6 +82,7 @@ describe('menuResolver', () => {
{ provide: ScriptDataService, useValue: scriptService },
{ provide: ConfigurationDataService, useValue: configurationDataService },
{ provide: NgbModal, useValue: mockNgbModal },
{ provide: AuthService, useValue: AuthServiceStub },
MenuResolverService,
],
schemas: [NO_ERRORS_SCHEMA],
Expand All @@ -94,19 +97,19 @@ describe('menuResolver', () => {
describe('resolve', () => {
it('should create all menus', (done) => {
spyOn(resolver, 'createPublicMenu$').and.returnValue(observableOf(true));
spyOn(resolver, 'createAdminMenu$').and.returnValue(observableOf(true));
spyOn(resolver, 'createAdminMenuIfLoggedIn$').and.returnValue(observableOf(true));

resolver.resolve(null, null).subscribe(resolved => {
expect(resolved).toBeTrue();
expect(resolver.createPublicMenu$).toHaveBeenCalled();
expect(resolver.createAdminMenu$).toHaveBeenCalled();
expect(resolver.createAdminMenuIfLoggedIn$).toHaveBeenCalled();
done();
});
});

it('should return an Observable that emits true as soon as all menus are created', () => {
spyOn(resolver, 'createPublicMenu$').and.returnValue(cold('--(t|)', BOOLEAN));
spyOn(resolver, 'createAdminMenu$').and.returnValue(cold('----(t|)', BOOLEAN));
spyOn(resolver, 'createAdminMenuIfLoggedIn$').and.returnValue(cold('----(t|)', BOOLEAN));

expect(resolver.resolve(null, null)).toBeObservable(cold('----(t|)', BOOLEAN));
});
Expand Down

0 comments on commit 6c1a2f2

Please sign in to comment.