Fixes tests

parent 593f3c92
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PipesModule } from '../../pipes/pipes.module';
import { CasLoginService } from '../../service/login/cas-login.service';
import { UserService } from '../../service/user/user.service';
import { SharedModule } from '../../shared/shared.module';
import { KeyOutputComponent } from './key-output.component';
......@@ -12,6 +14,9 @@ describe('KeyOutputComponent', () => {
TestBed.configureTestingModule({
imports: [SharedModule, PipesModule],
declarations: [KeyOutputComponent],
providers: [
CasLoginService, UserService,
],
})
.compileComponents();
}));
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NgbActiveModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { UserService } from '../../service/user/user.service';
import { SharedModule } from '../../shared/shared.module';
import { AddModeComponent } from './add-mode.component';
......@@ -14,7 +15,7 @@ describe('AddModeComponent', () => {
SharedModule, NgbModalModule.forRoot(),
],
providers: [
NgbActiveModal,
NgbActiveModal, UserService,
],
declarations: [AddModeComponent],
})
......
......@@ -3,6 +3,9 @@ import { async, TestBed } from '@angular/core/testing';
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';
import { StorageService } from '../../service/storage/storage.service';
import { StorageServiceMock } from '../../service/storage/storage.service.mock';
import { UserService } from '../../service/user/user.service';
import { FilterKeysPipe } from './filter-keys.pipe';
describe('FilterKeysPipe', () => {
......@@ -14,7 +17,10 @@ describe('FilterKeysPipe', () => {
HttpClientTestingModule,
],
providers: [
LanguageLoaderService, I18nManagerApiService, ProjectLoaderService,
LanguageLoaderService, I18nManagerApiService, ProjectLoaderService, UserService, {
provide: StorageService,
useClass: StorageServiceMock,
},
],
declarations: [
FilterKeysPipe,
......
......@@ -97,8 +97,10 @@ describe('QuizThemeComponent', () => {
it('#restoreTheme', () => {
const theme = 'theme-Material';
const previewedTheme = 'theme-arsnova-click';
component['previewThemeBackup'] = theme;
component.previewTheme(theme);
component.previewTheme(previewedTheme);
component.restoreTheme();
expect(document.getElementsByTagName('html').item(0).dataset['theme']).toEqual(theme);
});
......
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { inject, TestBed } from '@angular/core/testing';
import { CasLoginService } from '../login/cas-login.service';
import { IndexedDbService } from '../storage/indexed.db.service';
import { StorageService } from '../storage/storage.service';
import { UserService } from '../user/user.service';
import { LanguageLoaderService } from './language-loader.service';
......@@ -7,7 +11,7 @@ describe('LanguageLoaderService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [LanguageLoaderService],
providers: [LanguageLoaderService, CasLoginService, UserService, StorageService, IndexedDbService],
});
});
......
import { TestBed, inject } from '@angular/core/testing';
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 { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { createTranslateLoader } from '../../../lib/translation.factory';
import { SharedModule } from '../../shared/shared.module';
import { UserService } from '../user/user.service';
import { ProjectLoaderService } from './project-loader.service';
describe('ProjectLoaderService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [ProjectLoaderService]
imports: [
HttpClientTestingModule, SharedModule, RouterTestingModule, HttpClientModule, TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (
createTranslateLoader
),
deps: [HttpClient],
},
compiler: {
provide: TranslateCompiler,
useClass: TranslateMessageFormatCompiler,
},
}),
],
providers: [
ProjectLoaderService, UserService,
],
});
});
......
import { inject, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../shared/shared.module';
import { IndexedDbService } from './indexed.db.service';
import { StorageService } from './storage.service';
......@@ -7,7 +8,7 @@ describe('StorageService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [SharedModule],
providers: [StorageService],
providers: [StorageService, 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