Fixed tests to release can go through

This commit is contained in:
Erik Tiekstra
2021-05-18 10:08:57 +02:00
parent e1634dc221
commit fe80cceb84
15 changed files with 50 additions and 28 deletions

View File

@@ -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();

View File

@@ -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<ToastComponent>;
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();
});

View File

@@ -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;

View File

@@ -55,7 +55,7 @@
<div class="create-account__permission-checkbox">
<digi-ng-form-checkbox formControlName="permissions" afLabel="Välj administrera behörigheter">
</digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start">
<digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a>
</digi-ng-popover>
@@ -63,7 +63,7 @@
<div class="create-account__permission-checkbox">
<digi-ng-form-checkbox formControlName="participant" afLabel="Välj ta emot deltagare"></digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start">
<digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a>
</digi-ng-popover>
@@ -75,7 +75,7 @@
afLabel="Välj rapportering, planering och infomration om deltagare"
>
</digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start">
<digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a>
</digi-ng-popover>
@@ -84,7 +84,7 @@
<div class="create-account__permission-checkbox">
<digi-ng-form-checkbox formControlName="orderBills" afLabel="Välj administrera ordrar och fakturor">
</digi-ng-form-checkbox>
<digi-ng-popover afDirection="block-start">
<digi-ng-popover class="create-account__popover">
<p>Jag har tillräckligt med utrymme för att öppnas till höger (inline-start).</p>
<a href="#">Tab to me</a>
</digi-ng-popover>

View File

@@ -59,12 +59,12 @@
display: flex;
gap: var(--digi--layout--gutter);
}
}
.search-address {
width: 30%;
}
&__popover {
margin-left: var(--digi--layout--gutter);
digi-ng-popover {
margin-left: var(--digi--layout--gutter);
::ng-deep .digi-ng-popover__container {
z-index: 1;
}
}
}

View File

@@ -5,6 +5,7 @@ import { DigiNgFormRadiobuttonGroupModule } from '@af/digi-ng/_form/form-radiobu
import { DigiNgFormSelectModule } from '@af/digi-ng/_form/form-select';
import { DigiNgPopoverModule } from '@af/digi-ng/_popover/popover';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
@@ -17,6 +18,7 @@ describe('CreateAccountComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [CreateAccountComponent],
imports: [
RouterTestingModule,

View File

@@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { EmployeeCardComponent } from './employee-card.component';
@@ -10,6 +11,7 @@ describe('EmployeeCardComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EmployeeCardComponent],
imports: [RouterTestingModule, HttpClientTestingModule],
}).compileComponents();

View File

@@ -1,4 +1,5 @@
import { DigiNgTableModule } from '@af/digi-ng/_table/table';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { EmployeesListComponent } from './employees-list.component';
@@ -9,6 +10,7 @@ describe('EmployeesListComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EmployeesListComponent],
imports: [RouterTestingModule, DigiNgTableModule],
}).compileComponents();

View File

@@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { EmployeesComponent } from './employees.component';
@@ -10,6 +11,7 @@ describe('EmployeesComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EmployeesComponent],
imports: [RouterTestingModule, HttpClientTestingModule],
}).compileComponents();

View File

@@ -1,3 +1,4 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { PageNotFoundComponent } from './page-not-found.component';
@@ -9,6 +10,7 @@ describe('PageNotFoundComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [PageNotFoundComponent],
imports: [RouterTestingModule],
}).compileComponents();

View File

@@ -1,4 +1,5 @@
import { DigiNgTableModule } from '@af/digi-ng/_table/table';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ParticipantsListComponent } from './participants-list.component';
@@ -9,6 +10,7 @@ describe('ParticipantsListComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ParticipantsListComponent],
imports: [RouterTestingModule, DigiNgTableModule],
}).compileComponents();

View File

@@ -1,5 +1,6 @@
import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ParticipantsListModule } from './components/participants-list/participants-list.module';
@@ -12,6 +13,7 @@ describe('ParticipantsComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ParticipantsComponent],
imports: [RouterTestingModule, HttpClientTestingModule, DigiNgSkeletonBaseModule, ParticipantsListModule],
}).compileComponents();

View File

@@ -1,3 +1,4 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StartComponent } from './start.component';
@@ -9,6 +10,7 @@ describe('StartComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [StartComponent],
imports: [RouterTestingModule],
}).compileComponents();

View File

@@ -1,8 +1,6 @@
/* tslint:disable:no-unused-variable */
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { IconComponent } from './icon.component';
describe('IconComponent', () => {
@@ -11,9 +9,9 @@ describe('IconComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ IconComponent ]
})
.compileComponents();
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [IconComponent],
}).compileComponents();
}));
beforeEach(() => {

View File

@@ -1,8 +1,9 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { IconComponent } from './icon.component';
@NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [IconComponent],
imports: [CommonModule],
exports: [IconComponent],