Fixes tests

parent a2ecc496
Pipeline #21427 passed with stages
in 11 minutes and 12 seconds
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 { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
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 { StorageServiceMock } from '../../service/storage/storage.service.mock';
import { ThemesService } from '../../service/themes/themes.service';
import { TrackingMockService } from '../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../service/tracking/tracking.service';
import { WebsocketMockService } from '../../service/websocket/websocket.mock.service';
import { WebsocketService } from '../../service/websocket/websocket.service';
import { SharedModule } from '../../shared/shared.module';
import { AdminOverviewComponent } from './admin-overview.component';
......@@ -8,9 +32,41 @@ describe('AdminOverviewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminOverviewComponent ]
})
.compileComponents();
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
provide: TranslateCompiler,
useClass: TranslateMessageFormatCompiler,
},
}),
],
providers: [
I18nService, IndexedDbService, {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
useClass: CurrentQuizMockService,
}, {
provide: TrackingService,
useClass: TrackingMockService,
}, FooterBarService, SettingsService, {
provide: ConnectionService,
useClass: ConnectionMockService,
}, {
provide: WebsocketService,
useClass: WebsocketMockService,
}, SharedService,
],
declarations: [
AdminOverviewComponent,
],
}).compileComponents();
}));
beforeEach(() => {
......
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { PLATFORM_ID } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtHelperService, 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 { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
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 { StorageServiceMock } from '../../service/storage/storage.service.mock';
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';
import { QuizAdminComponent } from './quiz-admin.component';
......@@ -8,9 +36,47 @@ describe('QuizAdminComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QuizAdminComponent ]
})
.compileComponents();
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
provide: TranslateCompiler,
useClass: TranslateMessageFormatCompiler,
},
}), JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [PLATFORM_ID, StorageService],
},
}),
],
providers: [
I18nService, IndexedDbService, {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
useClass: CurrentQuizMockService,
}, {
provide: TrackingService,
useClass: TrackingMockService,
}, FooterBarService, SettingsService, {
provide: ConnectionService,
useClass: ConnectionMockService,
}, {
provide: WebsocketService,
useClass: WebsocketMockService,
}, SharedService, UserService, JwtHelperService,
],
declarations: [
QuizAdminComponent,
],
}).compileComponents();
}));
beforeEach(() => {
......
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { PLATFORM_ID } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtHelperService, 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 { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { CurrentQuizMockService } from '../../service/current-quiz/current-quiz.mock.service';
import { CurrentQuizService } from '../../service/current-quiz/current-quiz.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
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 { StorageServiceMock } from '../../service/storage/storage.service.mock';
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';
import { UserAdminComponent } from './user-admin.component';
......@@ -8,9 +36,47 @@ describe('UserAdminComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserAdminComponent ]
})
.compileComponents();
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
provide: TranslateCompiler,
useClass: TranslateMessageFormatCompiler,
},
}), JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [PLATFORM_ID, StorageService],
},
}),
],
providers: [
I18nService, IndexedDbService, {
provide: StorageService,
useClass: StorageServiceMock,
}, HeaderLabelService, ThemesService, {
provide: CurrentQuizService,
useClass: CurrentQuizMockService,
}, {
provide: TrackingService,
useClass: TrackingMockService,
}, FooterBarService, SettingsService, {
provide: ConnectionService,
useClass: ConnectionMockService,
}, {
provide: WebsocketService,
useClass: WebsocketMockService,
}, SharedService, UserService, JwtHelperService,
],
declarations: [
UserAdminComponent,
],
}).compileComponents();
}));
beforeEach(() => {
......
......@@ -27,7 +27,10 @@ export class AdditionalDataComponent {
private readonly _quizUrl: string;
constructor(@Inject(DOCUMENT) readonly document, public activeQuestionGroupService: ActiveQuestionGroupService, private trackingService: TrackingService) {
constructor(@Inject(DOCUMENT) readonly document,
public activeQuestionGroupService: ActiveQuestionGroupService,
private trackingService: TrackingService,
) {
}
public getQuizUrl(quizName: string): string {
......
......@@ -35,12 +35,10 @@ describe('FooterBarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, NgbModule.forRoot(), TranslateModule.forRoot({
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, NgbModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......@@ -90,56 +88,46 @@ describe('FooterBarComponent', () => {
expect(FooterBarComponent.TYPE).toEqual('FooterBarComponent');
}));
it('#getLinkTarget', (
inject([FooterBarService], (footerBarService: FooterBarService) => {
expect(component.getLinkTarget(footerBarService.footerElemAbout)).toEqual(jasmine.arrayContaining(['info', 'about']));
})
));
it('#getLinkTarget', (inject([FooterBarService], (footerBarService: FooterBarService) => {
expect(component.getLinkTarget(footerBarService.footerElemAbout)).toEqual(jasmine.arrayContaining(['info', 'about']));
})));
it('#toggleSetting', (
inject([FooterBarService, TrackingService], (footerBarService: FooterBarService, trackingService: TrackingService) => {
const elem = footerBarService.footerElemAbout;
spyOn(elem, 'onClickCallback').and.callFake(() => {});
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
component.toggleSetting(elem);
expect(elem.onClickCallback).toHaveBeenCalled();
expect(trackingService.trackClickEvent).toHaveBeenCalled();
})
));
it('#toggleSetting', (inject([FooterBarService, TrackingService], (footerBarService: FooterBarService, trackingService: TrackingService) => {
const elem = footerBarService.footerElemAbout;
spyOn(elem, 'onClickCallback').and.callFake(() => {});
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
component.toggleSetting(elem);
expect(elem.onClickCallback).toHaveBeenCalled();
expect(trackingService.trackClickEvent).toHaveBeenCalled();
})));
it('#fileChange', (
inject([FileUploadService], (fileUploadService: FileUploadService) => {
spyOn(fileUploadService, 'uploadFile').and.callFake(() => {});
component.fileChange({ target: { files: [{ name: 'testFile' }] } });
expect(fileUploadService.uploadFile).toHaveBeenCalled();
})
));
it('#fileChange', (inject([FileUploadService], (fileUploadService: FileUploadService) => {
spyOn(fileUploadService, 'uploadFile').and.callFake(() => {});
component.fileChange({ target: { files: [{ name: 'testFile' }] } });
expect(fileUploadService.uploadFile).toHaveBeenCalled();
})));
it('#moveLeft', (
inject([FooterBarService], (footerBarService: FooterBarService) => {
component['_footerElements'] = [
...Object.keys(footerBarService).map(t => footerBarService[t] instanceof FooterbarElement ? footerBarService[t] : false),
];
component.footerElemIndex = 2;
component.moveLeft();
expect(component.footerElemIndex).toEqual(1);
component.moveLeft();
expect(component.footerElemIndex).toEqual(1);
})
));
it('#moveLeft', (inject([FooterBarService], (footerBarService: FooterBarService) => {
component['_footerElements'] = [
...Object.keys(footerBarService).map(t => footerBarService[t] instanceof FooterbarElement ? footerBarService[t] : false),
];
component.footerElemIndex = 2;
component.moveLeft();
expect(component.footerElemIndex).toEqual(1);
component.moveLeft();
expect(component.footerElemIndex).toEqual(1);
})));
it('#moveRight', (
inject([FooterBarService], (footerBarService: FooterBarService) => {
component['_footerElements'] = [
...Object.keys(footerBarService).map(t => footerBarService[t] instanceof FooterbarElement ? footerBarService[t] : false),
];
component.footerElemIndex = 1;
it('#moveRight', (inject([FooterBarService], (footerBarService: FooterBarService) => {
component['_footerElements'] = [
...Object.keys(footerBarService).map(t => footerBarService[t] instanceof FooterbarElement ? footerBarService[t] : false),
];
component.footerElemIndex = 1;
component.moveRight();
expect(component.footerElemIndex).toEqual(2);
for (let i = 0; i < component.footerElements.length; i++) {
component.moveRight();
expect(component.footerElemIndex).toEqual(2);
for (let i = 0; i < component.footerElements.length; i++) {
component.moveRight();
}
expect(component.footerElemIndex).toEqual(component.footerElements.length - 1);
})
));
}
expect(component.footerElemIndex).toEqual(component.footerElements.length - 1);
})));
});
......@@ -14,6 +14,7 @@ import { TrackingMockService } from '../../service/tracking/tracking.mock.servic
import { TrackingService } from '../../service/tracking/tracking.service';
import { WebsocketMockService } from '../../service/websocket/websocket.mock.service';
import { WebsocketService } from '../../service/websocket/websocket.service';
import { SharedModule } from '../../shared/shared.module';
import { HeaderComponent } from './header.component';
describe('HeaderComponent', () => {
......@@ -23,12 +24,10 @@ describe('HeaderComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule, HttpClientModule, HttpClientTestingModule, NgbModule.forRoot(), TranslateModule.forRoot({
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, NgbModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......@@ -69,8 +68,8 @@ describe('HeaderComponent', () => {
expect(HeaderComponent.TYPE).toEqual('HeaderComponent');
}));
it('#openConnectionQualityModal', (
inject([TrackingService, NgbModal, ConnectionService], (trackingService: TrackingService, modalService: NgbModal, connectionService: ConnectionService) => {
it('#openConnectionQualityModal', (inject([TrackingService, NgbModal, ConnectionService],
(trackingService: TrackingService, modalService: NgbModal, connectionService: ConnectionService) => {
const modalContent = 'testcontent';
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
......@@ -82,6 +81,5 @@ describe('HeaderComponent', () => {
expect(trackingService.trackClickEvent).toHaveBeenCalled();
expect(modalService.open).toHaveBeenCalledWith(modalContent);
expect(connectionService.calculateRTT).toHaveBeenCalled();
})
));
})));
});
......@@ -36,19 +36,10 @@ describe('I18nManagerOverviewComponent', () => {
useFactory: jwtOptionsFactory,
deps: [PLATFORM_ID, StorageService],
},
}),
HttpClientTestingModule,
NgbModalModule.forRoot(),
SharedModule,
PipesModule,
RouterTestingModule,
HttpClientModule,
TranslateModule.forRoot({
}), HttpClientTestingModule, NgbModalModule, SharedModule, PipesModule, RouterTestingModule, HttpClientModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......
......@@ -32,12 +32,10 @@ describe('LivePreviewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule, HttpClientModule, HttpClientTestingModule, HeaderModule, NgbModule.forRoot(), TranslateModule.forRoot({
RouterTestingModule, HttpClientModule, HttpClientTestingModule, HeaderModule, NgbModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......
......@@ -7,6 +7,7 @@ import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-comp
import { createTranslateLoader } from '../../../lib/translation.factory';
import { TrackingMockService } from '../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../service/tracking/tracking.service';
import { SharedModule } from '../../shared/shared.module';
import { MarkdownBarComponent } from './markdown-bar.component';
......@@ -17,12 +18,10 @@ describe('MarkdownBarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......
......@@ -24,7 +24,7 @@ describe('AddModeComponent', () => {
useFactory: jwtOptionsFactory,
deps: [PLATFORM_ID, StorageService],
},
}), SharedModule, NgbModalModule.forRoot(),
}), SharedModule, NgbModalModule,
],
providers: [
IndexedDbService, {
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NgbActiveModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { SharedModule } from '../../shared/shared.module';
import { AddUserComponent } from './add-user.component';
......@@ -8,7 +10,9 @@ describe('AddUserComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddUserComponent ]
imports: [SharedModule, NgbModalModule],
providers: [NgbActiveModal],
declarations: [AddUserComponent],
})
.compileComponents();
}));
......
......@@ -38,12 +38,10 @@ describe('AvailableQuizzesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, NgbModule.forRoot(), TranslateModule.forRoot({
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, NgbModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......@@ -124,33 +122,33 @@ describe('AvailableQuizzesComponent', () => {
expect(activeModal.close).toHaveBeenCalled();
})));
it('#startQuiz', (
inject([CurrentQuizService, TrackingService], (currentQuizService: CurrentQuizService, trackingService: TrackingService) => {
const quiz = currentQuizService.quiz;
it('#startQuiz', (inject([CurrentQuizService, TrackingService], (currentQuizService: CurrentQuizService, trackingService: TrackingService) => {
const quiz = currentQuizService.quiz;
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
component.startQuiz(quiz);
component.startQuiz(quiz);
expect(trackingService.trackClickEvent).toHaveBeenCalled();
})
));
expect(trackingService.trackClickEvent).toHaveBeenCalled();
})));
it('#editQuiz', (
inject([CurrentQuizService, TrackingService, ActiveQuestionGroupService, Router],
(currentQuizService: CurrentQuizService, trackingService: TrackingService, activeQuestionGroupService: ActiveQuestionGroupService, router: Router) => {
const quiz = currentQuizService.quiz;
it('#editQuiz', (inject([CurrentQuizService, TrackingService, ActiveQuestionGroupService, Router], (
currentQuizService: CurrentQuizService,
trackingService: TrackingService,
activeQuestionGroupService: ActiveQuestionGroupService,
router: Router,
) => {
const quiz = currentQuizService.quiz;
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
spyOn(component, 'next').and.callThrough();
spyOn(router, 'navigate').and.callFake(() => {});
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
spyOn(component, 'next').and.callThrough();
spyOn(router, 'navigate').and.callFake(() => {});
component.editQuiz(quiz);
component.editQuiz(quiz);
expect(trackingService.trackClickEvent).toHaveBeenCalled();
expect(activeQuestionGroupService.activeQuestionGroup).toEqual(quiz);
expect(router.navigate).toHaveBeenCalled();
expect(component.next).toHaveBeenCalled();
})
));
expect(trackingService.trackClickEvent).toHaveBeenCalled();
expect(activeQuestionGroupService.activeQuestionGroup).toEqual(quiz);
expect(router.navigate).toHaveBeenCalled();
expect(component.next).toHaveBeenCalled();
})));
});
......@@ -43,12 +43,10 @@ describe('QuizLobbyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule, HttpClientModule, HttpClientTestingModule, SharedModule, NgxQRCodeModule, NgbModule.forRoot(), TranslateModule.forRoot({
RouterTestingModule, HttpClientModule, HttpClientTestingModule, SharedModule, NgxQRCodeModule, NgbModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......@@ -122,11 +120,7 @@ describe('QuizLobbyComponent', () => {
spyOn(component, 'kickMember').and.callThrough();
component.openKickMemberModal(modalContent, nickToRemove);
(
(
async () => await component.kickMember(nickToRemove)
)()
);
((async () => await component.kickMember(nickToRemove))());
expect(component.kickMember).toHaveBeenCalled();
}));
......
......@@ -65,9 +65,7 @@ describe('NicknameManagerComponent', () => {
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
......@@ -149,7 +147,8 @@ describe('NicknameManagerComponent', () => {
it('should list all available categories', () => {
const categories = component.availableNickCategories();
expect(categories)
.toEqual(jasmine.arrayWithExactContents(['disney', 'science', 'fantasy', 'literature', 'mythology', 'actor', 'politics', 'turing_award', 'emojis']));
.toEqual(
jasmine.arrayWithExactContents(['disney', 'science', 'fantasy', 'literature', 'mythology', 'actor', 'politics', 'turing_award', 'emojis']));
});
});
......
......@@ -5,7 +5,6 @@ import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { DefaultAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/answeroption_default';
import { IQuestionSurvey } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { createTranslateLoader } from '../../../../../../lib/translation.factory';
......@@ -24,6 +23,7 @@ import { TrackingMockService } from '../../../../../service/tracking/tracking.mo
import { TrackingService } from '../../../../../service/tracking/tracking.service';
import { WebsocketMockService } from '../../../../../service/websocket/websocket.mock.service';
import { WebsocketService } from '../../../../../service/websocket/websocket.service';
import { SharedModule } from '../../../../../shared/shared.module';
import { AnsweroptionsDefaultComponent } from './answeroptions-default.component';
......@@ -48,19 +48,17 @@ class MockRouterSurvey {
}
const imports = [
RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
SharedModule, RouterTestingModule, HttpClientModule, HttpClientTestingModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
useFactory: (createTranslateLoader),
deps: [HttpClient],
},
compiler: {
provide: TranslateCompiler,
useClass: TranslateMessageFormatCompiler,
},
}), NgbModalModule.forRoot(),
}), NgbModalModule,
];
const providers: Array<any> = [
......@@ -89,39 +87,31 @@ describe('AnsweroptionsDefaultComponent', () => {
let component: AnsweroptionsDefaultComponent;
let fixture: ComponentFixture<AnsweroptionsDefaultComponent>;
beforeEach((
() => {
providers.push({
provide: ActivatedRoute,