test: remove most of the boilerplate tests

This commit is contained in:
Frank Strieter
2022-03-22 14:50:00 +01:00
parent f6a9d5b038
commit d38bed1334
61 changed files with 19 additions and 1293 deletions

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { ConfirmDialogComponent } from './confirm-dialog.component'
describe('ConfirmDialogComponent', () => {
let component: ConfirmDialogComponent
let fixture: ComponentFixture<ConfirmDialogComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ConfirmDialogComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(ConfirmDialogComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { DateDropdownComponent } from './date-dropdown.component'
describe('DateDropdownComponent', () => {
let component: DateDropdownComponent
let fixture: ComponentFixture<DateDropdownComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DateDropdownComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(DateDropdownComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { EditDialogComponent } from './edit-dialog.component'
describe('EditDialogComponent', () => {
let component: EditDialogComponent
let fixture: ComponentFixture<EditDialogComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EditDialogComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(EditDialogComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -19,27 +19,27 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
) {}
@Input()
dialogMode: string = 'create'
dialogMode: string = 'create';
@Input()
object: T
object: T;
@Output()
success = new EventEmitter()
success = new EventEmitter();
networkActive = false
networkActive = false;
closeEnabled = false
closeEnabled = false;
error = null
error = null;
abstract getForm(): FormGroup
abstract getForm(): FormGroup;
objectForm: FormGroup = this.getForm()
objectForm: FormGroup = this.getForm();
ngOnInit(): void {
if (this.object != null) {
this.objectForm.patchValue(this.object)
this.objectForm.patchValue(this.object);
}
// wait to enable close button so it doesnt steal focus from input since its the first clickable element in the DOM
@@ -49,34 +49,34 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
}
getCreateTitle() {
return $localize`Create new item`
return $localize`Create new item`;
}
getEditTitle() {
return $localize`Edit item`
return $localize`Edit item`;
}
getSaveErrorMessage(error: string) {
return $localize`Could not save element: ${error}`
return $localize`Could not save element: ${error}`;
}
getTitle() {
switch (this.dialogMode) {
case 'create':
return this.getCreateTitle()
return this.getCreateTitle();
case 'edit':
return this.getEditTitle()
return this.getEditTitle();
default:
break
}
}
getMatchingAlgorithms() {
return MATCHING_ALGORITHMS
return MATCHING_ALGORITHMS;
}
get patternRequired(): boolean {
return this.objectForm?.value.matching_algorithm !== MATCH_AUTO
return this.objectForm?.value.matching_algorithm !== MATCH_AUTO;
}
save() {
@@ -90,7 +90,7 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
serverResponse = this.service.create(newObject)
break
case 'edit':
serverResponse = this.service.update(newObject)
serverResponse = this.service.update(newObject);
default:
break
}
@@ -108,6 +108,6 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
}
cancel() {
this.activeModal.close()
this.activeModal.close();
}
}

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { FilterableDropodownComponent } from './filterable-dropdown.component'
describe('FilterableDropodownComponent', () => {
let component: FilterableDropodownComponent
let fixture: ComponentFixture<FilterableDropodownComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FilterableDropodownComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(FilterableDropodownComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { ToggleableDropdownButtonComponent } from './toggleable-dropdown-button.component'
describe('ToggleableDropdownButtonComponent', () => {
let component: ToggleableDropdownButtonComponent
let fixture: ComponentFixture<ToggleableDropdownButtonComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ToggleableDropdownButtonComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(ToggleableDropdownButtonComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { CheckComponent } from './check.component'
describe('CheckComponent', () => {
let component: CheckComponent
let fixture: ComponentFixture<CheckComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CheckComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(CheckComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -17,6 +17,6 @@ import { AbstractInputComponent } from '../abstract-input'
})
export class CheckComponent extends AbstractInputComponent<boolean> {
constructor() {
super()
super();
}
}

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { ColorComponent } from './color.component'
describe('ColorComponent', () => {
let component: ColorComponent
let fixture: ComponentFixture<ColorComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ColorComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(ColorComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { DateComponent } from './date.component'
describe('DateComponent', () => {
let component: DateComponent
let fixture: ComponentFixture<DateComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DateComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(DateComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { NumberComponent } from './number.component'
describe('NumberComponent', () => {
let component: NumberComponent
let fixture: ComponentFixture<NumberComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [NumberComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(NumberComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { SelectComponent } from './select.component'
describe('SelectComponent', () => {
let component: SelectComponent
let fixture: ComponentFixture<SelectComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SelectComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(SelectComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { TagsComponent } from './tags.component'
describe('TagsComponent', () => {
let component: TagsComponent
let fixture: ComponentFixture<TagsComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TagsComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(TagsComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { TextComponent } from './text.component'
describe('TextComponent', () => {
let component: TextComponent
let fixture: ComponentFixture<TextComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TextComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(TextComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { PageHeaderComponent } from './page-header.component'
describe('PageHeaderComponent', () => {
let component: PageHeaderComponent
let fixture: ComponentFixture<PageHeaderComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PageHeaderComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(PageHeaderComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { SelectDialogComponent } from './select-dialog.component'
describe('SelectDialogComponent', () => {
let component: SelectDialogComponent
let fixture: ComponentFixture<SelectDialogComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SelectDialogComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(SelectDialogComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { TagComponent } from './tag.component'
describe('TagComponent', () => {
let component: TagComponent
let fixture: ComponentFixture<TagComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TagComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(TagComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})

View File

@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { ToastsComponent } from './toasts.component'
describe('ToastsComponent', () => {
let component: ToastsComponent
let fixture: ComponentFixture<ToastsComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ToastsComponent],
}).compileComponents()
})
beforeEach(() => {
fixture = TestBed.createComponent(ToastsComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})