Unsere GitLab-Installation wurde aktualisiert (Informationen zu den Neuerungen).

Fix tests

parent a911eea8
Pipeline #15640 failed with stages
in 1 minute and 22 seconds
......@@ -18,7 +18,7 @@
"build:PROD-STATS": "ng build --prod --stats-json",
"bundle-report": "webpack-bundle-analyzer dist/browser/stats.json",
"webpack:SERVER": "webpack --config webpack.server.config.js --progress --colors",
"test": "ng test --browsers=ChromeHeadless --watch=false",
"test": "ng test --browsers=ChromeHeadless --watch=false --source-map=false",
"lint": "ng lint",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e --no-webdriver-update",
......
......@@ -4,7 +4,6 @@ import { async, ComponentFixture, inject, 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 { DefaultSettings } from '../../../../lib/default.settings';
import { createTranslateLoader } from '../../../../lib/translation.factory';
import { ConnectionMockService } from '../../../service/connection/connection.mock.service';
import { ConnectionService } from '../../../service/connection/connection.service';
......@@ -81,12 +80,10 @@ describe('QuizThemeComponent', () => {
it('#updateTheme', async(inject(
[CurrentQuizService], (currentQuizService: CurrentQuizService) => {
const theme = 'theme-Material';
const updateQuizUrl = `${DefaultSettings.httpApiEndpoint}/quiz/settings/update`;
spyOn(currentQuizService, 'toggleSettingByName').and.callThrough();
component.updateTheme(theme).subscribe(() => {
backend.expectOne(updateQuizUrl).flush({});
expect(currentQuizService.quiz.sessionConfig.theme).toEqual(theme);
expect(currentQuizService.toggleSettingByName).toHaveBeenCalled();
});
......
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
import { DefaultAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/answeroption_default';
import { IQuestionGroup } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestion, IQuestionGroup } from 'arsnova-click-v2-types/src/questions/interfaces';
import { SingleChoiceQuestion } from 'arsnova-click-v2-types/src/questions/question_choice_single';
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/index';
import { DefaultSettings } from '../../../lib/default.settings';
@Injectable()
export class CurrentQuizMockService {
public quiz: IQuestionGroup;
public questionIndex: number = 0;
constructor(
@Inject(PLATFORM_ID) private _platformId: Object,
......@@ -28,6 +30,10 @@ export class CurrentQuizMockService {
});
}
public currentQuestion(): IQuestion {
return this.quiz.questionList[this.questionIndex];
}
public cacheQuiz(): Promise<any> {
return new Promise(resolve => (resolve()));
}
......@@ -39,4 +45,19 @@ export class CurrentQuizMockService {
public cleanUp(): Promise<any> {
return new Promise<any>(resolve => resolve());
}
public toggleSetting(): Observable<void> {
return of(null);
}
public persistToSessionStorage(): void {}
public toggleSettingByName(): Observable<void> {
return of(null);
}
public getVisibleQuestions(maxIndex?: number): Array<IQuestion> {
return this.quiz.questionList.slice(0, maxIndex || this.questionIndex + 1);
}
}
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