diff --git a/src/app/static-page/static-page.component.spec.ts b/src/app/static-page/static-page.component.spec.ts index c3a0b9c6d21..97df3c3d420 100644 --- a/src/app/static-page/static-page.component.spec.ts +++ b/src/app/static-page/static-page.component.spec.ts @@ -7,6 +7,9 @@ import { RouterMock } from '../shared/mocks/router.mock'; import { LocaleService } from '../core/locale/locale.service'; import { TranslateModule } from '@ngx-translate/core'; import { of } from 'rxjs'; +import { APP_CONFIG } from '../../config/app-config.interface'; +import { environment } from '../../environments/environment'; +import { ClarinSafeHtmlPipe } from '../shared/utils/clarin-safehtml.pipe'; describe('StaticPageComponent', () => { let component: StaticPageComponent; @@ -14,24 +17,32 @@ describe('StaticPageComponent', () => { let htmlContentService: HtmlContentService; let localeService: any; + let appConfig: any; beforeEach(async () => { htmlContentService = jasmine.createSpyObj('htmlContentService', { - fetchHtmlContent: of('
TEST MESSAGE
') + fetchHtmlContent: of('
TEST MESSAGE
') }); localeService = jasmine.createSpyObj('LocaleService', { getCurrentLanguageCode: jasmine.createSpy('getCurrentLanguageCode'), }); + appConfig = Object.assign(environment, { + ui: { + namespace: 'testNamespace' + } + }); + TestBed.configureTestingModule({ - declarations: [ StaticPageComponent ], + declarations: [ StaticPageComponent, ClarinSafeHtmlPipe ], imports: [ TranslateModule.forRoot() ], providers: [ { provide: HtmlContentService, useValue: htmlContentService }, { provide: Router, useValue: new RouterMock() }, - { provide: LocaleService, useValue: localeService } + { provide: LocaleService, useValue: localeService }, + { provide: APP_CONFIG, useValue: appConfig } ] }); @@ -51,6 +62,6 @@ describe('StaticPageComponent', () => { // Load `TEST MESSAGE` it('should load html file content', async () => { await component.ngOnInit(); - expect(component.htmlContent.value).toBe('
TEST MESSAGE
'); + expect(component.htmlContent.value).toBe('
TEST MESSAGE
'); }); });