Initial tests for OpenSlides3. Parallel execution of server and client

tests.
This commit is contained in:
Tobias Hößl 2018-09-02 11:05:09 +02:00 committed by FinnStutzenstein
parent 5d4faa288b
commit 9f291308aa
47 changed files with 2404 additions and 2247 deletions

View File

@ -1,27 +1,70 @@
language: python
dist: xenial
sudo: true
cache:
pip: true
yarn: true
python:
- "3.6"
- "3.7"
env:
- TRAVIS_NODE_VERSION="10.5"
before_install:
- nvm install $TRAVIS_NODE_VERSION
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
install:
- pip install --upgrade setuptools pip
- pip install --upgrade --requirement requirements/development.txt
- pip install --upgrade .[big_mode]
- pip freeze
- cd client && npm install && cd ..
script:
- cd client && npm run-script lint && cd ..
- flake8 openslides tests
- isort --check-only --diff --recursive openslides tests
- python -m mypy openslides/
- pytest tests/old/ tests/integration/ tests/unit/ --cov --cov-fail-under=75
matrix:
include:
- language: python
cache:
pip: true
python:
- "3.6"
env:
- TRAVIS_NODE_VERSION="10.5"
install:
- python --version
- pip install --upgrade setuptools pip
- pip install --upgrade --requirement requirements/development.txt
- pip install --upgrade .[big_mode]
- pip freeze
script:
- flake8 openslides tests
- isort --check-only --diff --recursive openslides tests
- python -m mypy openslides/
- pytest tests/old/ tests/integration/ tests/unit/ --cov --cov-fail-under=75
- language: python
cache:
pip: true
python:
- "3.7"
env:
- TRAVIS_NODE_VERSION="10.5"
install:
- python --version
- pip install --upgrade setuptools pip
- pip install --upgrade --requirement requirements/development.txt
- pip install --upgrade .[big_mode]
- pip freeze
script:
- flake8 openslides tests
- isort --check-only --diff --recursive openslides tests
- python -m mypy openslides/
- pytest tests/old/ tests/integration/ tests/unit/ --cov --cov-fail-under=75
- language: node_js
node_js:
- "9"
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
cache:
yarn: true
directories:
- $HOME/.yarn-cache
- node_modules
before_install:
- sh -e /etc/init.d/xvfb start
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- yarn global add @angular/cli
- ng --version
- cd client
install:
- yarn install
script:
- yarn run lint
- yarn run test --watch=false

4342
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { E2EImportsModule } from './../e2e-imports.module';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AppComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));
it('should create the app', async(() => {
@ -11,15 +12,4 @@ describe('AppComponent', () => {
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to client!');
}));
});

View File

@ -4,7 +4,7 @@ describe('CoreModule', () => {
let coreModule: CoreModule;
beforeEach(() => {
coreModule = new CoreModule(parent);
coreModule = new CoreModule(null);
});
it('should create an instance', () => {

View File

@ -1,12 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { NotifyService } from './notify.service';
describe('NotifyService', () => {
import { AppLoadService } from './app-load.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('AppLoadService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [NotifyService]
imports: [E2EImportsModule],
providers: [AppLoadService]
});
});
it('should be created', inject([NotifyService], (service: NotifyService) => {
it('should be created', inject([AppLoadService], (service: AppLoadService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -56,6 +56,4 @@ export class AppLoadService {
}
});
}
private registerModels(models?: { collectionString: string; model: ModelConstructor<BaseModel> }[]): void {}
}

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { AuthService } from './auth.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('ConfigService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [AuthService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { AutoupdateService } from './autoupdate.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('AutoupdateService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [AutoupdateService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { ConstantsService } from './constants.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('ConstantsService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [ConstantsService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { DataSendService } from './data-send.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('DataSendService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [DataSendService]
});
});

View File

@ -59,11 +59,6 @@ interface JsonStorage {
export class DataStoreService {
private static cachePrefix = 'DS:';
/**
* Make sure, that the Datastore only be instantiated once.
*/
private static wasInstantiated = false;
/** We will store the data twice: One as instances of the actual models in the _store
* and one serialized version in the _serializedStore for the cache. Both should be updated in
* all cases equal!
@ -115,12 +110,7 @@ export class DataStoreService {
* Empty constructor for dataStore
* @param cacheService use CacheService to cache the DataStore.
*/
public constructor(private cacheService: CacheService, private modelMapper: CollectionStringModelMapperService) {
if (DataStoreService.wasInstantiated) {
throw new Error('The Datastore should just be instantiated once!');
}
DataStoreService.wasInstantiated = true;
}
public constructor(private cacheService: CacheService, private modelMapper: CollectionStringModelMapperService) {}
/**
* Gets the DataStore from cache and instantiate all models out of the serialized version.

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { NotifyService } from './notify.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('NotifyService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [NotifyService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { OpenSlidesService } from './openslides.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('OpenSlidesService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [OpenSlidesService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { OperatorService } from './operator.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('OperatorService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [OperatorService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { WebsocketService } from './websocket.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('WebsocketService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [WebsocketService]
});
});

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectorComponent } from './projector.component';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('ProjectorComponent', () => {
let component: ProjectorComponent;
@ -8,6 +9,7 @@ describe('ProjectorComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [ProjectorComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { BaseComponent } from 'app/base.component';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'os-projector',
@ -8,8 +9,8 @@ import { Title } from '@angular/platform-browser';
styleUrls: ['./projector.component.css']
})
export class ProjectorComponent extends BaseComponent implements OnInit {
public constructor(protected titleService: Title) {
super(titleService);
public constructor(titleService: Title, translate: TranslateService) {
super(titleService, translate);
}
public ngOnInit(): void {

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FooterComponent } from './footer.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('FooterComponent', () => {
let component: FooterComponent;
@ -8,7 +9,7 @@ describe('FooterComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [FooterComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeadBarComponent } from './head-bar.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('HeadBarComponent', () => {
let component: HeadBarComponent;
@ -8,7 +9,7 @@ describe('HeadBarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [HeadBarComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LegalNoticeContentComponent } from './legal-notice-content.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('LegalNoticeComponent', () => {
let component: LegalNoticeContentComponent;
@ -8,7 +9,7 @@ describe('LegalNoticeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LegalNoticeContentComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PrivacyPolicyContentComponent } from './privacy-policy-content.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('PrivacyPolicyComponent', () => {
let component: PrivacyPolicyContentComponent;
@ -8,7 +9,7 @@ describe('PrivacyPolicyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PrivacyPolicyContentComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,24 +1,48 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchValueSelectorComponent } from './search-value-selector.component';
import { SearchValueSelectorComponent, Selectable } from './search-value-selector.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
import { ViewChild, Component } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { FormControl, FormBuilder } from '@angular/forms';
describe('SearchValueSelectorComponent', () => {
let component: SearchValueSelectorComponent;
let fixture: ComponentFixture<SearchValueSelectorComponent>;
@Component({
selector: 'os-host-component',
template: '<os-search-value-selector></os-search-value-selector>'
})
class TestHostComponent {
@ViewChild(SearchValueSelectorComponent)
public searchValueSelectorComponent: SearchValueSelectorComponent;
}
let hostComponent: TestHostComponent;
let hostFixture: ComponentFixture<TestHostComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [SearchValueSelectorComponent]
imports: [E2EImportsModule],
declarations: [TestHostComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SearchValueSelectorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
hostFixture = TestBed.createComponent(TestHostComponent);
hostComponent = hostFixture.componentInstance;
});
it('should create', () => {
expect(component).toBeTruthy();
const subject: BehaviorSubject<Selectable[]> = new BehaviorSubject([]);
hostComponent.searchValueSelectorComponent.InputListValues = subject;
const formBuilder: FormBuilder = TestBed.get(FormBuilder);
const formGroup = formBuilder.group({
testArray: []
});
hostComponent.searchValueSelectorComponent.form = formGroup;
hostComponent.searchValueSelectorComponent.formControl = <FormControl>formGroup.get('testArray');
hostFixture.detectChanges();
expect(hostComponent.searchValueSelectorComponent).toBeTruthy();
});
});

View File

@ -7,7 +7,7 @@ import { Displayable } from '../../models/base/displayable';
import { TranslateService } from '@ngx-translate/core';
import { Identifiable } from '../../models/base/identifiable';
type Selectable = Displayable & Identifiable;
export type Selectable = Displayable & Identifiable;
/**
* Reusable Searchable Value Selector

View File

@ -39,6 +39,8 @@ import { TranslateModule } from '@ngx-translate/core';
// directives
import { PermsDirective } from './directives/perms.directive';
import { DomChangeDirective } from './directives/dom-change.directive';
// components
import { HeadBarComponent } from './components/head-bar/head-bar.component';
import { FooterComponent } from './components/footer/footer.component';
import { LegalNoticeContentComponent } from './components/legal-notice-content/legal-notice-content.component';

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AgendaListComponent } from './agenda-list.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('AgendaListComponent', () => {
let component: AgendaListComponent;
@ -8,6 +9,7 @@ describe('AgendaListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [AgendaListComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AssignmentListComponent } from './assignment-list.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('AssignmentListComponent', () => {
let component: AssignmentListComponent;
@ -8,6 +9,7 @@ describe('AssignmentListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [AssignmentListComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LegalNoticeComponent } from './legal-notice.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LegalNoticeComponent', () => {
let component: LegalNoticeComponent;
@ -8,6 +9,7 @@ describe('LegalNoticeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [LegalNoticeComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PrivacyPolicyComponent } from './privacy-policy.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('PrivacyPolicyComponent', () => {
let component: PrivacyPolicyComponent;
@ -8,6 +9,7 @@ describe('PrivacyPolicyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [PrivacyPolicyComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StartComponent } from './start.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('StartComponent', () => {
let component: StartComponent;
@ -8,6 +9,7 @@ describe('StartComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [StartComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginLegalNoticeComponent } from './login-legal-notice.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LoginLegalNoticeComponent', () => {
let component: LoginLegalNoticeComponent;
@ -8,7 +9,7 @@ describe('LoginLegalNoticeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LoginLegalNoticeComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginMaskComponent } from './login-mask.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LoginMaskComponent', () => {
let component: LoginMaskComponent;
@ -8,7 +9,7 @@ describe('LoginMaskComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LoginMaskComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));
@ -21,4 +22,10 @@ describe('LoginMaskComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
// TODO: mock HTTPClient
/*it('should have an forget password button', async(() => {
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.forgot-password-button').textContent).toContain('Forgot Password?');
}));*/
});

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginPrivacyPolicyComponent } from './login-privacy-policy.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LoginPrivacyPolicyComponent', () => {
let component: LoginPrivacyPolicyComponent;
@ -8,7 +9,7 @@ describe('LoginPrivacyPolicyComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LoginPrivacyPolicyComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginComponent } from './login.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LoginComponent', () => {
let component: LoginComponent;
@ -8,7 +9,7 @@ describe('LoginComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LoginComponent]
imports: [E2EImportsModule]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MediafileListComponent } from './mediafile-list.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('MediafileListComponent', () => {
let component: MediafileListComponent;
@ -8,6 +9,7 @@ describe('MediafileListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [MediafileListComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CategoryListComponent } from './category-list.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('CategoryListComponent', () => {
let component: CategoryListComponent;
@ -8,6 +9,7 @@ describe('CategoryListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [CategoryListComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MotionDetailComponent } from './motion-detail.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('MotionDetailComponent', () => {
let component: MotionDetailComponent;
@ -8,6 +9,7 @@ describe('MotionDetailComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [MotionDetailComponent]
}).compileComponents();
}));

View File

@ -104,7 +104,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
super();
this.createForm();
if (route.snapshot.url[0].path === 'new') {
if (route.snapshot.url[0] && route.snapshot.url[0].path === 'new') {
this.newMotion = true;
this.editMotion = true;

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MotionListComponent } from './motion-list.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('MotionListComponent', () => {
let component: MotionListComponent;
@ -8,6 +9,7 @@ describe('MotionListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [MotionListComponent]
}).compileComponents();
}));

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { CategoryRepositoryService } from './category-repository.service';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('CategoryRepositoryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [CategoryRepositoryService]
});
});

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { MotionRepositoryService } from './motion-repository.service';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('MotionRepositoryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [MotionRepositoryService]
});
});

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingsListComponent } from './settings-list.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('SettingsListComponent', () => {
let component: SettingsListComponent;
@ -8,6 +9,7 @@ describe('SettingsListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [SettingsListComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SiteComponent } from './site.component';
import { E2EImportsModule } from '../../e2e-imports.module';
describe('SiteComponent', () => {
let component: SiteComponent;
@ -8,6 +9,7 @@ describe('SiteComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [SiteComponent]
}).compileComponents();
}));

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserDetailComponent } from './user-detail.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('UserDetailComponent', () => {
let component: UserDetailComponent;
@ -8,6 +9,7 @@ describe('UserDetailComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [UserDetailComponent]
}).compileComponents();
}));

View File

@ -64,7 +64,7 @@ export class UserDetailComponent implements OnInit {
private op: OperatorService
) {
this.user = new ViewUser();
if (route.snapshot.url[0].path === 'new') {
if (route.snapshot.url[0] && route.snapshot.url[0].path === 'new') {
this.newUser = true;
this.setEditMode(true);
} else {

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserListComponent } from './user-list.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('UserListComponent', () => {
let component: UserListComponent;
@ -8,6 +9,7 @@ describe('UserListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [UserListComponent]
}).compileComponents();
}));

View File

@ -1,10 +1,12 @@
import { TestBed, inject } from '@angular/core/testing';
import { UserRepositoryService } from './user-repository.service';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('UserRepositoryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [UserRepositoryService]
});
});

View File

@ -0,0 +1,42 @@
import { NgModule } from '@angular/core';
import { APP_BASE_HREF, CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { SharedModule } from 'app/shared/shared.module';
import { AppModule, HttpLoaderFactory } from 'app/app.module';
import { AppRoutingModule } from 'app/app-routing.module';
import { LoginModule } from 'app/site/login/login.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
/**
* Share Module for all "dumb" components and pipes.
*
* These components don not import and inject services from core or other features
* in their constructors.
*
* Should receive all data though attributes in the template of the component using them.
* No dependency to the rest of our application.
*/
@NgModule({
imports: [
AppModule,
CommonModule,
SharedModule,
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
LoginModule,
BrowserAnimationsModule,
AppRoutingModule
],
exports: [CommonModule, SharedModule, HttpClientModule, TranslateModule, AppRoutingModule],
providers: [{ provide: APP_BASE_HREF, useValue: '/' }]
})
export class E2EImportsModule {}