test: resolve import issues in spec files

This commit is contained in:
4gray committed 2024-11-19 00:02:40 +01:00
1 parent be9faca26c
commit 7e28686df3
6 files changed
+58 -62

No files matched your search

-1
View File
@@ -7,7 +7,6 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ServiceWorkerModule } from '@angular/service-worker';
// NG Translate
import { EffectsModule } from '@ngrx/effects';
import { StoreRouterConnectingModule, routerReducer } from '@ngrx/router-store';
import { StoreModule } from '@ngrx/store';
@@ -4,7 +4,7 @@ import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { MatTooltipModule } from '@angular/material/tooltip';
import { TranslatePipe } from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import * as moment from 'moment';
import { MockModule, MockPipe } from 'ng-mocks';
import { MomentDatePipe } from './../../../../shared/pipes/moment-date.pipe';
@@ -61,23 +61,18 @@ describe('EpgListItemComponent', () => {
let fixture: ComponentFixture<EpgListItemComponent>;
let dialog: MatDialog;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
EpgListItemComponent,
MockPipe(MomentDatePipe),
MockPipe(TranslatePipe),
],
imports: [
MockModule(MatDialogModule),
MockModule(MatListModule),
MockModule(MatIconModule),
MockModule(MatTooltipModule),
],
}).compileComponents();
})
);
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [EpgListItemComponent, MockPipe(MomentDatePipe)],
imports: [
MockModule(MatDialogModule),
MockModule(MatListModule),
MockModule(MatIconModule),
MockModule(MatTooltipModule),
MockModule(TranslateModule),
],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EpgListItemComponent);
@@ -20,6 +20,7 @@ import { VjsPlayerComponent } from '../vjs-player/vjs-player.component';
import { InfoOverlayComponent } from './../info-overlay/info-overlay.component';
import { VideoPlayerComponent } from './video-player.component';
import { CommonModule } from '@angular/common';
import { Actions } from '@ngrx/effects';
import { provideMockActions } from '@ngrx/effects/testing';
import { NgxIndexedDBService } from 'ngx-indexed-db';
@@ -37,48 +38,47 @@ describe('VideoPlayerComponent', () => {
let mockStore: MockStore;
const actions$ = new Observable<Actions>();
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
MockComponent(EpgListComponent),
MockComponent(HtmlVideoPlayerComponent),
MockComponent(VjsPlayerComponent),
MockComponent(VideoPlayerComponent),
MockComponent(ChannelListContainerComponent),
MockComponent(InfoOverlayComponent),
VideoPlayerComponent,
MockPipe(TranslatePipe),
],
providers: [
{ provide: MatSnackBar, useClass: MatSnackBarStub },
{ provide: DataService, useClass: ElectronServiceStub },
{
provide: ActivatedRoute,
useValue: {
params: of({ id: '1' }),
snapshot: {
queryParams: {
url: 'https://iptvnator/list.m3u',
},
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
MockComponent(EpgListComponent),
MockComponent(HtmlVideoPlayerComponent),
MockComponent(VjsPlayerComponent),
MockComponent(VideoPlayerComponent),
MockComponent(ChannelListContainerComponent),
MockComponent(InfoOverlayComponent),
VideoPlayerComponent,
MockPipe(TranslatePipe),
CommonModule,
],
providers: [
{ provide: MatSnackBar, useClass: MatSnackBarStub },
{ provide: DataService, useClass: ElectronServiceStub },
{
provide: ActivatedRoute,
useValue: {
params: of({ id: '1' }),
snapshot: {
queryParams: {
url: 'https://iptvnator/list.m3u',
},
},
},
provideMockStore(),
provideMockActions(actions$),
MockProviders(NgxIndexedDBService, PlaylistsService),
],
imports: [
MockModule(MatSidenavModule),
MockModule(MatIconModule),
MockModule(MatToolbarModule),
MockModule(MatTooltipModule),
MockModule(RouterTestingModule),
MockModule(MatDividerModule),
],
}).compileComponents();
})
);
},
provideMockStore(),
provideMockActions(actions$),
MockProviders(NgxIndexedDBService, PlaylistsService),
],
imports: [
MockModule(MatSidenavModule),
MockModule(MatIconModule),
MockModule(MatToolbarModule),
MockModule(MatTooltipModule),
MockModule(RouterTestingModule),
MockModule(MatDividerModule),
],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(VideoPlayerComponent);
@@ -25,4 +25,8 @@ export class ElectronServiceStub {
sendIpcEvent() {}
listenOn() {}
getAppEnvironment() {
return 'electron';
}
}
+1 -3
View File
@@ -35,7 +35,6 @@ import { EPG_FORCE_FETCH } from '../../../shared/ipc-commands';
import { DataService } from '../services/data.service';
import { ElectronServiceStub } from '../services/electron.service.stub';
import { HeaderComponent } from '../shared/components';
import { SharedModule } from '../shared/shared.module';
import { Language } from './language.enum';
import { SettingsComponent } from './settings.component';
import { VideoPlayer } from './settings.interface';
@@ -63,7 +62,7 @@ const DEFAULT_SETTINGS = {
mpvPlayerPath: '',
vlcPlayerPath: '',
remoteControl: false,
remoteControlPort: 3000
remoteControlPort: 3000,
};
describe('SettingsComponent', () => {
@@ -108,7 +107,6 @@ describe('SettingsComponent', () => {
MockModule(MatCheckboxModule),
MockModule(MatDividerModule),
MockModule(TranslateModule),
MockModule(SharedModule),
],
}).compileComponents();
}));
@@ -1,6 +1,6 @@
import { MomentDatePipe } from './moment-date.pipe';
describe('Pipe: MomentDatee', () => {
describe('Pipe: MomentDate', () => {
it('create an instance', () => {
const pipe = new MomentDatePipe();
expect(pipe).toBeTruthy();