Skip to content

Commit

Permalink
test: import missing modules (#359)
Browse files Browse the repository at this point in the history
* fix(test): Add BrowserAnimationsModule

* refactor(resource): notification service instead console.error

* test: Fix small issues

* refactor(status): Delete status component

* test: Import BrowserAnimationsModule

* test: import CommonModul

* test: import dialog and error component; needed when dsp-stack is down

* test: activate all tests

* test(user): Fix warnings
  • Loading branch information
André Kilchenmann committed Jan 13, 2021
1 parent 15d1182 commit 690a55e
Show file tree
Hide file tree
Showing 48 changed files with 300 additions and 134 deletions.
6 changes: 0 additions & 6 deletions src/app/app-routing.module.ts
Expand Up @@ -28,8 +28,6 @@ import { ResultsComponent } from './workspace/results/results.component';
import { SystemComponent } from './system/system.component';
import { ProjectsComponent } from './system/projects/projects.component';
import { UsersComponent } from './system/users/users.component';
import { StatusComponent } from './system/status/status.component';
import { GroupsComponent } from './system/groups/groups.component';

const routes: Routes = [
{
Expand Down Expand Up @@ -142,10 +140,6 @@ const routes: Routes = [
{
path: 'users',
component: UsersComponent
},
{
path: 'status',
component: StatusComponent
}
]
},
Expand Down
2 changes: 0 additions & 2 deletions src/app/app.module.ts
Expand Up @@ -54,7 +54,6 @@ import { GroupsListComponent } from './system/groups/groups-list/groups-list.com
import { GroupsComponent } from './system/groups/groups.component';
import { ProjectsListComponent } from './system/projects/projects-list/projects-list.component';
import { ProjectsComponent } from './system/projects/projects.component';
import { StatusComponent } from './system/status/status.component';
import { SystemComponent } from './system/system.component';
import { UsersListComponent } from './system/users/users-list/users-list.component';
import { UsersComponent } from './system/users/users.component';
Expand Down Expand Up @@ -125,7 +124,6 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
DialogComponent,
SystemComponent,
UsersComponent,
StatusComponent,
UsersListComponent,
DialogHeaderComponent,
GridComponent,
Expand Down
2 changes: 2 additions & 0 deletions src/app/main/cache/cache.service.spec.ts
@@ -1,11 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { MatDialogModule } from '@angular/material/dialog';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { CacheService } from './cache.service';

describe('CacheService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
BrowserAnimationsModule,
MatDialogModule,
MatSnackBarModule
]
Expand Down
4 changes: 4 additions & 0 deletions src/app/main/dialog/dialog.component.spec.ts
Expand Up @@ -13,6 +13,7 @@ import { MatSelectModule } from '@angular/material/select';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTreeModule } from '@angular/material/tree';
import { RouterTestingModule } from '@angular/router/testing';
import { DspActionModule } from '@dasch-swiss/dsp-ui';
import { TranslateModule } from '@ngx-translate/core';
import { ListInfoFormComponent } from 'src/app/project/list/list-info-form/list-info-form.component';
Expand All @@ -25,6 +26,7 @@ import { ProjectFormComponent } from 'src/app/project/project-form/project-form.
import { MembershipComponent } from 'src/app/user/membership/membership.component';
import { PasswordFormComponent } from 'src/app/user/user-form/password-form/password-form.component';
import { UserFormComponent } from 'src/app/user/user-form/user-form.component';
import { ErrorComponent } from '../error/error.component';
import { DialogHeaderComponent } from './dialog-header/dialog-header.component';
import { DialogComponent } from './dialog.component';

Expand All @@ -37,6 +39,7 @@ describe('DialogComponent', () => {
declarations: [
DialogComponent,
DialogHeaderComponent,
ErrorComponent,
UserFormComponent,
MembershipComponent,
PasswordFormComponent,
Expand Down Expand Up @@ -64,6 +67,7 @@ describe('DialogComponent', () => {
MatTooltipModule,
MatTreeModule,
ReactiveFormsModule,
RouterTestingModule,
TranslateModule.forRoot()
],
providers: [
Expand Down
2 changes: 0 additions & 2 deletions src/app/main/error/error.component.spec.ts
@@ -1,4 +1,3 @@
import { CommonModule } from '@angular/common';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIconModule } from '@angular/material/icon';
import { RouterTestingModule } from '@angular/router/testing';
Expand All @@ -12,7 +11,6 @@ describe('ErrorComponent', () => {
TestBed.configureTestingModule({
declarations: [ErrorComponent],
imports: [
CommonModule,
MatIconModule,
RouterTestingModule
]
Expand Down
10 changes: 9 additions & 1 deletion src/app/main/help/help.component.spec.ts
Expand Up @@ -8,6 +8,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { AppInitService, DspApiConfigToken, DspApiConnectionToken } from '@dasch-swiss/dsp-ui';
import { TestConfig } from 'test.config';
import { DialogComponent } from '../dialog/dialog.component';
import { ErrorComponent } from '../error/error.component';
import { FooterComponent } from '../footer/footer.component';
import { GridComponent } from '../grid/grid.component';
import { HelpComponent } from './help.component';
Expand All @@ -18,7 +20,13 @@ describe('HelpComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [HelpComponent, FooterComponent, GridComponent],
declarations: [
HelpComponent,
FooterComponent,
GridComponent,
DialogComponent,
ErrorComponent
],
imports: [
BrowserAnimationsModule,
MatButtonModule,
Expand Down
14 changes: 12 additions & 2 deletions src/app/main/main.component.spec.ts
Expand Up @@ -6,11 +6,14 @@ import { MatIconModule } from '@angular/material/icon';
import { MatSelectModule } from '@angular/material/select';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { By } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { AppInitService, DspActionModule, DspApiConnectionToken, SessionService, DspApiConfigToken } from '@dasch-swiss/dsp-ui';
import { AppInitService, DspActionModule, DspApiConfigToken, DspApiConnectionToken, SessionService } from '@dasch-swiss/dsp-ui';
import { of } from 'rxjs';
import { TestConfig } from 'test.config';
import { DialogComponent } from './dialog/dialog.component';
import { ErrorComponent } from './error/error.component';
import { FooterComponent } from './footer/footer.component';
import { GridComponent } from './grid/grid.component';
import { MainComponent } from './main.component';
Expand All @@ -23,8 +26,15 @@ describe('MainComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MainComponent, FooterComponent, GridComponent],
declarations: [
MainComponent,
FooterComponent,
GridComponent,
DialogComponent,
ErrorComponent
],
imports: [
BrowserAnimationsModule,
DspActionModule,
MatButtonModule,
MatDividerModule,
Expand Down
@@ -1,25 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { PersonTemplateComponent } from '../person-template/person-template.component';
import { AttributionTabViewComponent } from './attribution-tab-view.component';


describe('AttributionTabViewComponent', () => {
let component: AttributionTabViewComponent;
let fixture: ComponentFixture<AttributionTabViewComponent>;
let component: AttributionTabViewComponent;
let fixture: ComponentFixture<AttributionTabViewComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttributionTabViewComponent ]
})
.compileComponents();
}));
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AttributionTabViewComponent, PersonTemplateComponent
]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(AttributionTabViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(() => {
fixture = TestBed.createComponent(AttributionTabViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
8 changes: 7 additions & 1 deletion src/app/project/board/board.component.spec.ts
Expand Up @@ -3,14 +3,17 @@ import { MatChipsModule } from '@angular/material/chips';
import { MatDialogModule } from '@angular/material/dialog';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { AppInitService, DspActionModule, DspApiConfigToken, DspApiConnectionToken, DspCoreModule } from '@dasch-swiss/dsp-ui';
import { of } from 'rxjs';
import { DialogComponent } from 'src/app/main/dialog/dialog.component';
import { ErrorComponent } from 'src/app/main/error/error.component';
import { TestConfig } from 'test.config';
import { BoardComponent } from './board.component';
import { AttributionTabViewComponent } from './attribution-tab-view/attribution-tab-view.component';
import { BoardComponent } from './board.component';
import { ContactsTabViewComponent } from './contacts-tab-view/contacts-tab-view.component';
import { DatasetTabViewComponent } from './dataset-tab-view/dataset-tab-view.component';
import { ProjectTabViewComponent } from './project-tab-view/project-tab-view.component';
Expand All @@ -24,13 +27,16 @@ describe('BoardComponent', () => {
TestBed.configureTestingModule({
declarations: [
BoardComponent,
DialogComponent,
ErrorComponent,
AttributionTabViewComponent,
ContactsTabViewComponent,
DatasetTabViewComponent,
ProjectTabViewComponent,
TermsTabViewComponent
],
imports: [
BrowserAnimationsModule,
DspActionModule,
DspCoreModule,
MatChipsModule,
Expand Down
7 changes: 3 additions & 4 deletions src/app/project/board/board.component.ts
@@ -1,21 +1,20 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
import { MatRadioChange } from '@angular/material/radio';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Params } from '@angular/router';
import {
ApiResponseData,
ApiResponseError,
KnoraApiConnection,
ProjectResponse,
ReadProject,
ReadUser
ReadProject
} from '@dasch-swiss/dsp-js';
import { DspApiConnectionToken, Session, SessionService } from '@dasch-swiss/dsp-ui';
import { ClipboardService } from 'ngx-clipboard';
import { DialogComponent } from 'src/app/main/dialog/dialog.component';
import { ErrorHandlerService } from 'src/app/main/error/error-handler.service';
import { CacheService } from '../../main/cache/cache.service';
import { MatRadioChange } from '@angular/material/radio';
import { ClipboardService } from 'ngx-clipboard';

@Component({
selector: 'app-board',
Expand Down
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ContactsTabViewComponent } from './contacts-tab-view.component';
import { Component, ViewChild } from '@angular/core';
import { PersonTemplateComponent } from '../person-template/person-template.component';
import { AddressTemplateComponent } from '../address-template/address-template.component';

/**
* Test host component to simulate parent component.
Expand Down Expand Up @@ -33,7 +35,9 @@ describe('ContactsTabViewComponent', () => {
TestBed.configureTestingModule({
declarations: [
TestHostBoardComponent,
ContactsTabViewComponent
AddressTemplateComponent,
ContactsTabViewComponent,
PersonTemplateComponent
]
})
.compileComponents();
Expand Down
@@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PersonTemplateComponent } from './person-template.component';
import { Component, ViewChild } from '@angular/core';
import { AddressTemplateComponent } from '../address-template/address-template.component';


/**
Expand Down Expand Up @@ -34,6 +35,7 @@ describe('PersonTemplateComponent', () => {
TestBed.configureTestingModule({
declarations: [
TestHostContactComponent,
AddressTemplateComponent,
PersonTemplateComponent
]
})
Expand Down
Expand Up @@ -9,7 +9,7 @@ <h3 class="label mat-subheading-1">
{{ prop.key }}
</h3>
</div>
<div ngSwitch="{{ prop.key }}" class="property-value">
<div [ngSwitch]="prop.key" class="property-value">

<!-- #################### template for discipline ################# -->
<div *ngSwitchCase="'discipline'">
Expand Down
@@ -1,6 +1,12 @@
import { Component, ViewChild } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatCardModule } from '@angular/material/card';
import { MatChipsModule } from '@angular/material/chips';
import { MatIconModule } from '@angular/material/icon';
import { AddressTemplateComponent } from '../address-template/address-template.component';
import { OrganisationTemplateComponent } from '../organisation-template/organisation-template.component';
import { PersonTemplateComponent } from '../person-template/person-template.component';
import { ProjectTabViewComponent } from './project-tab-view.component';
import { Component, ViewChild } from '@angular/core';

/**
* Test host component to simulate parent component.
Expand Down Expand Up @@ -94,7 +100,15 @@ describe('ProjectTabViewComponent', () => {
TestBed.configureTestingModule({
declarations: [
TestHostBoardComponent,
AddressTemplateComponent,
OrganisationTemplateComponent,
PersonTemplateComponent,
ProjectTabViewComponent
],
imports: [
MatCardModule,
MatChipsModule,
MatIconModule
]
})
.compileComponents();
Expand Down
Expand Up @@ -4,6 +4,7 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
import {
Expand All @@ -14,6 +15,8 @@ import {
DspCoreModule
} from '@dasch-swiss/dsp-ui';
import { TranslateModule } from '@ngx-translate/core';
import { DialogComponent } from 'src/app/main/dialog/dialog.component';
import { ErrorComponent } from 'src/app/main/error/error.component';
import { TestConfig } from 'test.config';
import { AddUserComponent } from './add-user.component';

Expand All @@ -23,8 +26,13 @@ describe('AddUserComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AddUserComponent],
declarations: [
AddUserComponent,
DialogComponent,
ErrorComponent
],
imports: [
BrowserAnimationsModule,
DspActionModule,
DspCoreModule,
MatAutocompleteModule,
Expand Down
4 changes: 4 additions & 0 deletions src/app/project/collaboration/collaboration.component.spec.ts
Expand Up @@ -7,6 +7,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatMenuModule } from '@angular/material/menu';
import { MatSelectModule } from '@angular/material/select';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
Expand All @@ -19,6 +20,7 @@ import {
} from '@dasch-swiss/dsp-ui';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { DialogComponent } from 'src/app/main/dialog/dialog.component';
import { ErrorComponent } from 'src/app/main/error/error.component';
import { UsersListComponent } from 'src/app/system/users/users-list/users-list.component';
import { TestConfig } from 'test.config';
Expand All @@ -37,9 +39,11 @@ describe('CollaborationComponent', () => {
AddUserComponent,
UsersListComponent,
SelectGroupComponent,
DialogComponent,
ErrorComponent
],
imports: [
BrowserAnimationsModule,
DspActionModule,
DspCoreModule,
MatAutocompleteModule,
Expand Down

0 comments on commit 690a55e

Please sign in to comment.