-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Käser
committed
Mar 21, 2024
1 parent
11c8bfb
commit aa4d904
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
frontend/src/app/shared/services/chustomization.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; | ||
import { CustomizationService } from "./customization.service"; | ||
import { DOCUMENT } from "@angular/common"; | ||
import { ConfigService } from "../../config.service"; | ||
import { Observable, of } from "rxjs"; | ||
|
||
describe('CustomizationService', () => { | ||
let service: CustomizationService; | ||
|
||
const body = { | ||
title: "title", | ||
favicon: "favicon", | ||
logo: "logo", | ||
customStyles: {cssVar1: "foo"} | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HttpClientTestingModule], | ||
providers: [ | ||
{ provide: DOCUMENT, useValue: undefined}, | ||
{ provide: ConfigService, useValue: { | ||
config$: of(body) | ||
}} | ||
] | ||
}); | ||
service = TestBed.inject(CustomizationService); | ||
}); | ||
|
||
it('should be created', () => { | ||
const currentConfig = service.getCurrentConfig(); | ||
expect(currentConfig?.title).toBe(body.title) | ||
expect(currentConfig?.logo).toBe(body.logo) | ||
expect(currentConfig?.favicon).toBe(body.favicon) | ||
expect(currentConfig?.customStyles['cssVar1']).toBe(body.customStyles['cssVar1']) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters