test: add missing dependency

This commit is contained in:
4gray committed 2021-02-19 19:32:53 +01:00
1 parent b79cf37476
commit c03da33c44
7 files changed
+62 -34

No files matched your search

+26 -21
View File
@@ -1,11 +1,11 @@
import { TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { TranslateModule } from '@ngx-translate/core';
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
import { ElectronService } from './services/electron.service';
import { ElectronServiceStub } from './home/home.component.spec';
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MockModule } from 'ng-mocks';
import { MockModule, MockPipe } from 'ng-mocks';
jest.mock('custom-electron-titlebar', () => {
return {
@@ -23,24 +23,29 @@ class MatSnackBarStub {
}
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
providers: [
{ provide: ElectronService, useClass: ElectronServiceStub },
{ provide: MatSnackBar, useClass: MatSnackBarStub },
],
imports: [
MockModule(MatSnackBarModule),
RouterTestingModule,
TranslateModule.forRoot(),
],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AppComponent, MockPipe(TranslatePipe)],
providers: [
{ provide: ElectronService, useClass: ElectronServiceStub },
{ provide: MatSnackBar, useClass: MatSnackBarStub },
],
imports: [
MockModule(MatSnackBarModule),
RouterTestingModule,
TranslateModule.forRoot(),
],
}).compileComponents();
})
);
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(
'should create the app',
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
})
);
});