From df086547097235ebccbbaa562c7ee2d29071f3d1 Mon Sep 17 00:00:00 2001 From: minottic Date: Wed, 25 Sep 2024 14:53:49 +0200 Subject: [PATCH] Make sure ngOnInit is called --- src/app/app.component.spec.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index fad1a6f9..a9aa8f47 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,4 +1,4 @@ -import { TestBed, waitForAsync } from "@angular/core/testing"; +import { fakeAsync, TestBed, waitForAsync } from "@angular/core/testing"; import { RouterTestingModule } from "@angular/router/testing"; import { AppComponent } from "./app.component"; import { APP_CONFIG } from "./app-config.module"; @@ -35,17 +35,14 @@ describe("AppComponent", () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.componentInstance; expect(app.title).toEqual("ESS Public Data Repository test"); - expect(app.config.scicatBaseUrl).toEqual("https://scicat.esss.se"); - expect(app.config.lbBaseURL).toEqual("https://scicat.esss.se/api"); - expect(LoopBackConfig.getPath()).toEqual("https://scicat.esss.se/api"); }); - it(`should test app config values'`, () => { + it(`should test app config values'`, fakeAsync(() => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.componentInstance; - app.ngOnInit(); + fixture.detectChanges(); expect(app.config.scicatBaseUrl).toEqual("https://scicat.esss.se"); expect(app.config.lbBaseURL).toEqual("https://scicat.esss.se/api"); expect(LoopBackConfig.getPath()).toEqual("https://scicat.esss.se/api"); - }); + })); });