Skip to content

Commit

Permalink
Fix config value from BE config
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Sep 25, 2024
1 parent 9c79efe commit 2100e89
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app/app-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface AppConfig {
logoBanner: string | null;
logoWidth?: string;
retrieveToEmail: RetrieveDestinations | undefined;
lbBaseURL: string | null;
}

export class RetrieveDestinations {
Expand Down
12 changes: 11 additions & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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";
import { MatToolbarModule } from "@angular/material/toolbar";
import { HttpClientModule } from "@angular/common/http";
import { APP_DYN_CONFIG } from "./app-config.service";
import { MockAppConfigService } from "./shared/MockStubs";
import { LoopBackConfig } from "./shared/sdk";

describe("AppComponent", () => {
beforeEach(waitForAsync(() => {
Expand Down Expand Up @@ -35,4 +36,13 @@ describe("AppComponent", () => {
const app = fixture.componentInstance;
expect(app.title).toEqual("ESS Public Data Repository test");
});

it(`should test app config values'`, fakeAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
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");
}));
});
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AppComponent implements OnInit {
}

ngOnInit() {
LoopBackConfig.setBaseURL(this.config.scicatBaseUrl);
LoopBackConfig.setBaseURL(this.config.lbBaseURL);
console.log("API Path: ", LoopBackConfig.getPath());
console.log("API Version: ", LoopBackConfig.getApiVersion());
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/MockStubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class MockAppConfigService extends AppConfigService {
accessInstructions:
"Instructions: Login with brightness username and password",
scicatBaseUrl: "https://scicat.esss.se",
lbBaseUrl: "https://scicat.esss.se",
lbBaseURL: "https://scicat.esss.se/api",
retrieveToEmail: {
option: "URLs",
username: "lp_service",
Expand Down

0 comments on commit 2100e89

Please sign in to comment.