Fixes tests

parent c4508fa6
Pipeline #18232 failed with stages
in 5 minutes and 12 seconds
......@@ -117,7 +117,7 @@ describe('FooterBarComponent', () => {
it('#moveLeft', (
inject([FooterBarService], (footerBarService: FooterBarService) => {
component.footerElements = [
component['_footerElements'] = [
...Object.keys(footerBarService).map(t => footerBarService[t] instanceof FooterbarElement ? footerBarService[t] : false),
];
component.footerElemIndex = 2;
......@@ -130,7 +130,7 @@ describe('FooterBarComponent', () => {
it('#moveRight', (
inject([FooterBarService], (footerBarService: FooterBarService) => {
component.footerElements = [
component['_footerElements'] = [
...Object.keys(footerBarService).map(t => footerBarService[t] instanceof FooterbarElement ? footerBarService[t] : false),
];
component.footerElemIndex = 1;
......
......@@ -2,9 +2,11 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { PipesModule } from '../../pipes/pipes.module';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
......@@ -27,7 +29,13 @@ describe('I18nManagerOverviewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
HttpClientTestingModule, NgbModalModule.forRoot(), SharedModule, PipesModule, RouterTestingModule, HttpClientModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), HttpClientTestingModule, NgbModalModule.forRoot(), SharedModule, PipesModule, RouterTestingModule, HttpClientModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { PipesModule } from '../../pipes/pipes.module';
import { CasLoginService } from '../../service/login/cas-login.service';
import { IndexedDbService } from '../../service/storage/indexed.db.service';
......@@ -15,7 +17,15 @@ describe('KeyOutputComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [SharedModule, PipesModule],
imports: [
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, PipesModule,
],
declarations: [KeyOutputComponent],
providers: [
IndexedDbService, {
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { NgbActiveModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { IndexedDbService } from '../../service/storage/indexed.db.service';
import { StorageService } from '../../service/storage/storage.service';
import { StorageServiceMock } from '../../service/storage/storage.service.mock';
......@@ -15,7 +17,13 @@ describe('AddModeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, NgbModalModule.forRoot(),
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, NgbModalModule.forRoot(),
],
providers: [
IndexedDbService, {
......
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, TestBed } from '@angular/core/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { I18nManagerApiService } from '../../service/api/i18n-manager/i18n-manager-api.service';
import { LanguageLoaderService } from '../../service/language-loader/language-loader.service';
import { ProjectLoaderService } from '../../service/project-loader/project-loader.service';
......@@ -15,7 +17,13 @@ describe('FilterKeysPipe', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
HttpClientTestingModule,
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), HttpClientTestingModule,
],
providers: [
LanguageLoaderService, I18nManagerApiService, ProjectLoaderService, UserService, IndexedDbService, {
......
......@@ -3,9 +3,11 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { of } from 'rxjs/index';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { LobbyApiService } from '../../service/api/lobby/lobby-api.service';
import { QuizApiService } from '../../service/api/quiz/quiz-api.service';
......@@ -55,7 +57,13 @@ describe('QuizJoinComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......
......@@ -2,9 +2,11 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { availableQuestionTypes } from '../../../../lib/available-question-types';
import { jwtOptionsFactory } from '../../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../../lib/translation.factory';
import { FooterModule } from '../../../footer/footer.module';
import { ActiveQuestionGroupMockService } from '../../../service/active-question-group/active-question-group.mock.service';
......@@ -22,6 +24,7 @@ import { StorageService } from '../../../service/storage/storage.service';
import { StorageServiceMock } from '../../../service/storage/storage.service.mock';
import { TrackingMockService } from '../../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../../service/tracking/tracking.service';
import { UserService } from '../../../service/user/user.service';
import { WebsocketMockService } from '../../../service/websocket/websocket.mock.service';
import { WebsocketService } from '../../../service/websocket/websocket.service';
import { SharedModule } from '../../../shared/shared.module';
......@@ -35,7 +38,13 @@ describe('QuizManagerComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
HttpClientTestingModule, SharedModule, RouterTestingModule, HttpClientModule, FooterModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), HttpClientTestingModule, SharedModule, RouterTestingModule, HttpClientModule, FooterModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......@@ -50,7 +59,7 @@ describe('QuizManagerComponent', () => {
}),
],
providers: [
IndexedDbService, {
UserService, IndexedDbService, {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, {
......
......@@ -3,6 +3,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { DefaultAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/answeroption_default';
import { SingleChoiceQuestion } from 'arsnova-click-v2-types/src/questions/question_choice_single';
......@@ -10,6 +11,7 @@ import { DefaultQuestionGroup } from 'arsnova-click-v2-types/src/questions/quest
import { SessionConfiguration } from 'arsnova-click-v2-types/src/session_configuration/session_config';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { DefaultSettings } from '../../../lib/default.settings';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { ActiveQuestionGroupMockService } from '../../service/active-question-group/active-question-group.mock.service';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
......@@ -26,6 +28,7 @@ import { StorageService } from '../../service/storage/storage.service';
import { StorageServiceMock } from '../../service/storage/storage.service.mock';
import { TrackingMockService } from '../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../service/tracking/tracking.service';
import { UserService } from '../../service/user/user.service';
import { WebsocketMockService } from '../../service/websocket/websocket.mock.service';
import { WebsocketService } from '../../service/websocket/websocket.service';
import { DB_TABLE } from '../../shared/enums';
......@@ -79,7 +82,13 @@ describe('QuizOverviewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......@@ -94,7 +103,7 @@ describe('QuizOverviewComponent', () => {
}),
],
providers: [
IndexedDbService, {
UserService, IndexedDbService, {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, {
......
......@@ -4,9 +4,11 @@ import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'
import { DomSanitizer } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { ModalsModule } from '../../modals/modals.module';
import { ActiveQuestionGroupMockService } from '../../service/active-question-group/active-question-group.mock.service';
......@@ -47,7 +49,13 @@ describe('HomeComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......@@ -137,7 +145,7 @@ describe('HomeComponent', () => {
describe('#autoJoinToSession', () => {
it('should join the SESSION by click', async(inject([Router], (router: Router) => {
it('should join the session by click', async(inject([Router], (router: Router) => {
spyOn(component, 'selectQuizByList').and.callThrough();
spyOn(router, 'navigate').and.callFake(() => {});
......
......@@ -187,7 +187,10 @@ export class HomeComponent implements OnInit, OnDestroy {
public showQuiznameDatalist(): void {
if (isPlatformBrowser(this.platformId)) {
const elem = document.getElementById('hashtag-input-data-list');
elem.classList.remove('d-none');
if (elem) {
elem.classList.remove('d-none');
}
}
this.isShowingQuiznameDatalist = true;
}
......@@ -195,7 +198,10 @@ export class HomeComponent implements OnInit, OnDestroy {
public hideQuiznameDatalist(): void {
if (isPlatformBrowser(this.platformId)) {
const elem = document.getElementById('hashtag-input-data-list');
elem.classList.add('d-none');
if (elem) {
elem.classList.add('d-none');
}
}
this.isShowingQuiznameDatalist = false;
}
......
......@@ -4,8 +4,10 @@ import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'
import { FormsModule } from '@angular/forms';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
......@@ -24,7 +26,13 @@ describe('LoginComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, FormsModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, FormsModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......
......@@ -3,8 +3,10 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../../lib/translation.factory';
import { AttendeeMockService } from '../../../service/attendee/attendee.mock.service';
import { AttendeeService } from '../../../service/attendee/attendee.service';
......@@ -32,7 +34,13 @@ describe('NicknameInputComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......
......@@ -4,8 +4,10 @@ import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'
import { DomSanitizer } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../../lib/translation.factory';
import { AttendeeMockService } from '../../../service/attendee/attendee.mock.service';
import { AttendeeService } from '../../../service/attendee/attendee.service';
......@@ -33,7 +35,13 @@ describe('NicknameSelectComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......
......@@ -2,9 +2,11 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { FooterBarComponent } from '../../footer/footer-bar/footer-bar.component';
import { HeaderComponent } from '../../header/header/header.component';
......@@ -21,9 +23,11 @@ import { I18nService } from '../../service/i18n/i18n.service';
import { SettingsService } from '../../service/settings/settings.service';
import { SharedService } from '../../service/shared/shared.service';
import { IndexedDbService } from '../../service/storage/indexed.db.service';
import { StorageService } from '../../service/storage/storage.service';
import { ThemesService } from '../../service/themes/themes.service';
import { TrackingMockService } from '../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../service/tracking/tracking.service';
import { UserService } from '../../service/user/user.service';
import { WebsocketMockService } from '../../service/websocket/websocket.mock.service';
import { WebsocketService } from '../../service/websocket/websocket.service';
import { SharedModule } from '../../shared/shared.module';
......@@ -37,7 +41,13 @@ describe('RootComponent', () => {
() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......@@ -52,7 +62,7 @@ describe('RootComponent', () => {
}), NgbModule.forRoot(),
],
providers: [
IndexedDbService, HeaderLabelService, ThemesService, {
UserService, IndexedDbService, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
useClass: CurrentQuizMockService,
}, {
......@@ -91,6 +101,6 @@ describe('RootComponent', () => {
});
it('#getFooterBarElements', () => {
expect(component.getFooterBarElements().length).toBe(0);
component.getFooterBarElements().subscribe(elements => expect(elements.length).toBe(0));
});
});
......@@ -6,6 +6,7 @@ import { RangedQuestion } from 'arsnova-click-v2-types/src/questions/question_ra
import { SurveyQuestion } from 'arsnova-click-v2-types/src/questions/question_survey';
import { DefaultQuestionGroup } from 'arsnova-click-v2-types/src/questions/questiongroup_default';
import { SessionConfiguration } from 'arsnova-click-v2-types/src/session_configuration/session_config';
import { Observable, of } from 'rxjs';
import { DefaultSettings } from '../../../lib/default.settings';
export class ActiveQuestionGroupMockService {
......@@ -50,7 +51,7 @@ export class ActiveQuestionGroupMockService {
public persist(): void {}
public loadData(): Promise<void> {
return new Promise(resolve => resolve());
public loadData(): Observable<IQuestionGroup> {
return of(this.activeQuestionGroup);
}
}
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { inject, TestBed } from '@angular/core/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { CasLoginService } from '../login/cas-login.service';
import { IndexedDbService } from '../storage/indexed.db.service';
import { StorageService } from '../storage/storage.service';
......@@ -10,7 +12,15 @@ import { LanguageLoaderService } from './language-loader.service';
describe('LanguageLoaderService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
imports: [
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), HttpClientTestingModule,
],
providers: [LanguageLoaderService, CasLoginService, UserService, StorageService, IndexedDbService],
});
});
......
import { HttpClientModule } from '@angular/common/http';
import { async, inject, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { SharedModule } from '../../shared/shared.module';
import { IndexedDbService } from '../storage/indexed.db.service';
import { StorageService } from '../storage/storage.service';
......@@ -13,7 +15,13 @@ describe('CasLoginService', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule,
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule,
],
providers: [
IndexedDbService, {
......
import { inject, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { SharedModule } from '../../shared/shared.module';
import { IndexedDbService } from '../storage/indexed.db.service';
import { StorageService } from '../storage/storage.service';
......@@ -11,7 +13,15 @@ import { StaticLoginService } from './static-login.service';
describe('StaticLoginService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [SharedModule, RouterTestingModule],
imports: [
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule,
],
providers: [
IndexedDbService, {
provide: StorageService,
......
......@@ -2,8 +2,10 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { inject, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { SharedModule } from '../../shared/shared.module';
import { IndexedDbService } from '../storage/indexed.db.service';
......@@ -17,7 +19,13 @@ describe('ProjectLoaderService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
HttpClientTestingModule, SharedModule, RouterTestingModule, HttpClientModule, TranslateModule.forRoot({
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), HttpClientTestingModule, SharedModule, RouterTestingModule, HttpClientModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
......
import { HttpClientModule } from '@angular/common/http';
import { async, inject, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { SharedModule } from '../../shared/shared.module';
import { IndexedDbService } from '../storage/indexed.db.service';
import { StorageService } from '../storage/storage.service';
......@@ -12,7 +14,13 @@ describe('UserService', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule,
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [StorageService],
},
}), SharedModule, RouterTestingModule, HttpClientModule,
],
providers: [
IndexedDbService, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment