fix: Fixed test units
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AboutComponent } from './about.component';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
|
||||
describe('AboutComponent', () => {
|
||||
let component: AboutComponent;
|
||||
@@ -8,7 +10,11 @@ describe('AboutComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [AboutComponent]
|
||||
declarations: [AboutComponent],
|
||||
imports: [
|
||||
MatDialogModule,
|
||||
MatListModule
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CleanComponent } from './clean.component';
|
||||
import { UpdatesService } from 'src/app/services/updates.service';
|
||||
import { of } from 'rxjs';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatDatepicker } from '@angular/material/datepicker';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@Component({selector: "app-date-selector", template: ''})
|
||||
class DateSelectorStub {
|
||||
@Input() date: moment.Moment = moment.utc().startOf('day');
|
||||
@Output() dateChange = new EventEmitter<moment.Moment>();
|
||||
@Input() filter: (date: moment.Moment | null) => boolean = () => true
|
||||
}
|
||||
|
||||
describe('CleanComponent', () => {
|
||||
let component: CleanComponent;
|
||||
let fixture: ComponentFixture<CleanComponent>;
|
||||
let updates: jasmine.SpyObj<UpdatesService>
|
||||
|
||||
beforeEach(async () => {
|
||||
updates = jasmine.createSpyObj<UpdatesService>("UpdatesService", {
|
||||
getClean: of()
|
||||
})
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CleanComponent]
|
||||
declarations: [CleanComponent, DateSelectorStub],
|
||||
providers: [
|
||||
{provide: UpdatesService, useValue: updates}
|
||||
],
|
||||
imports: [MatDialogModule, MatIconModule, MatFormFieldModule, MatDatepicker]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExtraComponent } from './extra.component';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
|
||||
describe('ExtraComponent', () => {
|
||||
let component: ExtraComponent;
|
||||
@@ -8,7 +10,11 @@ describe('ExtraComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ExtraComponent]
|
||||
declarations: [ExtraComponent],
|
||||
imports: [
|
||||
MatDialogModule,
|
||||
MatListModule
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -1,20 +1,37 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MatInputHarness } from '@angular/material/input/testing'
|
||||
import { RedirectComponent } from './redirect.component';
|
||||
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { AuthClient } from 'src/app/services/auth.client';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('RedirectComponent', () => {
|
||||
let component: RedirectComponent;
|
||||
let fixture: ComponentFixture<RedirectComponent>;
|
||||
let loader: HarnessLoader
|
||||
let authMock
|
||||
|
||||
beforeEach(async () => {
|
||||
authMock = jasmine.createSpyObj<AuthClient>("AuthClient", {}, {redirect: ''})
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [RedirectComponent]
|
||||
declarations: [RedirectComponent],
|
||||
providers: [
|
||||
{provide: MatDialogRef, useValue: {}},
|
||||
{provide: AuthClient, useValue: authMock}
|
||||
],
|
||||
imports: [MatDialogModule, MatFormFieldModule, MatInputModule, FormsModule, NoopAnimationsModule]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(RedirectComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
loader = TestbedHarnessEnvironment.loader(fixture)
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { KeyComponent } from './key.component';
|
||||
import { UpdatesService } from 'src/app/services/updates.service';
|
||||
import { of } from 'rxjs';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
describe('KeyComponent', () => {
|
||||
let component: KeyComponent;
|
||||
let fixture: ComponentFixture<KeyComponent>;
|
||||
let uMock: jasmine.SpyObj<UpdatesService>
|
||||
|
||||
beforeEach(async () => {
|
||||
uMock = jasmine.createSpyObj<UpdatesService>("UpdatesService", {
|
||||
getKeys: of()
|
||||
})
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [KeyComponent]
|
||||
declarations: [KeyComponent],
|
||||
providers: [
|
||||
{provide: UpdatesService, useValue: uMock}
|
||||
],
|
||||
imports: [MatDialogModule, MatIconModule]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -3,23 +3,30 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PersonalComponent } from './personal.component';
|
||||
import { AuthClient } from 'src/app/services/auth.client';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { SwUpdate } from '@angular/service-worker';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { AppUpdateService } from 'src/app/services/app-update.service';
|
||||
import { of } from 'rxjs';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
describe('PersonalComponent', () => {
|
||||
let component: PersonalComponent;
|
||||
let fixture: ComponentFixture<PersonalComponent>;
|
||||
let auMock: jasmine.SpyObj<AppUpdateService>
|
||||
|
||||
beforeEach(() => {
|
||||
auMock = jasmine.createSpyObj("aumock", {
|
||||
checkForUpdate: of()
|
||||
})
|
||||
const authMock = jasmine.createSpyObj('AuthClient', ['s'])
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PersonalComponent],
|
||||
providers: [
|
||||
{provide: AuthClient, useValue: authMock},
|
||||
{provide: AppUpdateService, useValue: auMock}
|
||||
],
|
||||
imports: [MatDialogModule, MatSnackBarModule, MatListModule, BrowserAnimationsModule]
|
||||
imports: [MatDialogModule, MatSnackBarModule, MatListModule, NoopAnimationsModule, MatIconModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(PersonalComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
Reference in New Issue
Block a user