From fe80cceb842f28cd4ca688c8ffe576cc33bc75fa Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Tue, 18 May 2021 10:08:57 +0200 Subject: [PATCH] Fixed tests to release can go through --- apps/dafa-web/src/app/app.component.spec.ts | 2 ++ .../toast-list/toast/toast.component.spec.ts | 17 +++++++++++------ .../src/app/data/models/error/custom-error.ts | 10 +++++----- .../create-account.component.html | 8 ++++---- .../create-account.component.scss | 12 ++++++------ .../create-account.component.spec.ts | 2 ++ .../employee-card.component.spec.ts | 2 ++ .../employees-list.component.spec.ts | 2 ++ .../pages/employees/employees.component.spec.ts | 2 ++ .../page-not-found.component.spec.ts | 2 ++ .../participants-list.component.spec.ts | 2 ++ .../participants/participants.component.spec.ts | 2 ++ .../src/app/pages/start/start.component.spec.ts | 2 ++ .../components/icon/icon.component.spec.ts | 10 ++++------ .../app/shared/components/icon/icon.module.ts | 3 ++- 15 files changed, 50 insertions(+), 28 deletions(-) diff --git a/apps/dafa-web/src/app/app.component.spec.ts b/apps/dafa-web/src/app/app.component.spec.ts index 2f7255f..ba91f8b 100644 --- a/apps/dafa-web/src/app/app.component.spec.ts +++ b/apps/dafa-web/src/app/app.component.spec.ts @@ -1,4 +1,5 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; @@ -9,6 +10,7 @@ import { SkipToContentModule } from './components/skip-to-content/skip-to-conten describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [AppComponent], imports: [RouterTestingModule, HttpClientTestingModule, SkipToContentModule, NavigationModule, SidebarModule], }).compileComponents(); diff --git a/apps/dafa-web/src/app/components/toast-list/toast/toast.component.spec.ts b/apps/dafa-web/src/app/components/toast-list/toast/toast.component.spec.ts index b3fc46d..a954dfc 100644 --- a/apps/dafa-web/src/app/components/toast-list/toast/toast.component.spec.ts +++ b/apps/dafa-web/src/app/components/toast-list/toast/toast.component.spec.ts @@ -1,21 +1,26 @@ /* tslint:disable:no-unused-variable */ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { CustomError } from '@dafa-models/error/custom-error'; import { ToastComponent } from './toast.component'; - describe('ToastComponent', () => { let component: ToastComponent; let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ToastComponent], - }).compileComponents(); - })); + beforeEach( + waitForAsync(() => { + TestBed.configureTestingModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], + declarations: [ToastComponent], + }).compileComponents(); + }) + ); beforeEach(() => { fixture = TestBed.createComponent(ToastComponent); component = fixture.componentInstance; + component.error = new CustomError({ error: { name: 'Test', message: 'TestError' } }); fixture.detectChanges(); }); diff --git a/apps/dafa-web/src/app/data/models/error/custom-error.ts b/apps/dafa-web/src/app/data/models/error/custom-error.ts index e33d875..3da9600 100644 --- a/apps/dafa-web/src/app/data/models/error/custom-error.ts +++ b/apps/dafa-web/src/app/data/models/error/custom-error.ts @@ -12,13 +12,13 @@ export class CustomError implements Error { error: Error; removeAfter: number; - constructor(args: { error: Error; type: ErrorType; message?: string; severity?: ErrorSeverity; stack?: string }) { + constructor(args: { error: Error; type?: ErrorType; message?: string; severity?: ErrorSeverity; stack?: string }) { this.timestamp = new Date(); this.id = this.timestamp.getTime().toString(); - this.type = this.name = args.type; - this.message = args.message ? args.message : args.error.message; - this.severity = args.severity ? args.severity : ErrorSeverity.HIGH; - this.stack = args.stack ? args.stack : CustomError.getStack(args.error); + this.type = this.name = args.type || ErrorType.UNKNOWN; + this.message = args.message || args.error.message; + this.severity = args.severity || ErrorSeverity.HIGH; + this.stack = args.stack || CustomError.getStack(args.error); this.error = args.error; this.removeAfter = this.severity === ErrorSeverity.LOW ? 5000 : this.severity === ErrorSeverity.MEDIUM ? 10000 : 20000; diff --git a/apps/dafa-web/src/app/pages/administration/pages/create-account/create-account.component.html b/apps/dafa-web/src/app/pages/administration/pages/create-account/create-account.component.html index 88b2c46..f1346c6 100644 --- a/apps/dafa-web/src/app/pages/administration/pages/create-account/create-account.component.html +++ b/apps/dafa-web/src/app/pages/administration/pages/create-account/create-account.component.html @@ -55,7 +55,7 @@