Merge pull request #3865 from FinnStutzenstein/OpenSlides-3-tests

OpenSlides 3 tests
This commit is contained in:
Finn Stutzenstein 2018-10-08 14:16:55 +02:00 committed by GitHub
commit 8a04951940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 2404 additions and 2247 deletions

View File

@ -1,27 +1,70 @@
language: python
dist: xenial dist: xenial
sudo: true sudo: true
cache:
pip: true matrix:
yarn: true include:
python: - language: python
- "3.6" cache:
- "3.7" pip: true
env: python:
- TRAVIS_NODE_VERSION="10.5" - "3.6"
before_install: env:
- nvm install $TRAVIS_NODE_VERSION - TRAVIS_NODE_VERSION="10.5"
- curl -o- -L https://yarnpkg.com/install.sh | bash install:
- export PATH="$HOME/.yarn/bin:$PATH" - python --version
install: - pip install --upgrade setuptools pip
- pip install --upgrade setuptools pip - pip install --upgrade --requirement requirements/development.txt
- pip install --upgrade --requirement requirements/development.txt - pip install --upgrade .[big_mode]
- pip install --upgrade .[big_mode] - pip freeze
- pip freeze script:
- cd client && npm install && cd .. - flake8 openslides tests
script: - isort --check-only --diff --recursive openslides tests
- cd client && npm run-script lint && cd .. - python -m mypy openslides/
- flake8 openslides tests - pytest tests/old/ tests/integration/ tests/unit/ --cov --cov-fail-under=75
- isort --check-only --diff --recursive openslides tests
- python -m mypy openslides/ - language: python
- pytest tests/old/ tests/integration/ tests/unit/ --cov --cov-fail-under=75 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 { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { E2EImportsModule } from './../e2e-imports.module';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [AppComponent] imports: [E2EImportsModule]
}).compileComponents(); }).compileComponents();
})); }));
it('should create the app', async(() => { it('should create the app', async(() => {
@ -11,15 +12,4 @@ describe('AppComponent', () => {
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy(); 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; let coreModule: CoreModule;
beforeEach(() => { beforeEach(() => {
coreModule = new CoreModule(parent); coreModule = new CoreModule(null);
}); });
it('should create an instance', () => { it('should create an instance', () => {

View File

@ -1,12 +1,15 @@
import { TestBed, inject } from '@angular/core/testing'; import { TestBed, inject } from '@angular/core/testing';
import { NotifyService } from './notify.service'; import { AppLoadService } from './app-load.service';
describe('NotifyService', () => { import { E2EImportsModule } from '../../../e2e-imports.module';
describe('AppLoadService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ 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(); 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 { TestBed, inject } from '@angular/core/testing';
import { AuthService } from './auth.service'; import { AuthService } from './auth.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('ConfigService', () => { describe('ConfigService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [AuthService] providers: [AuthService]
}); });
}); });

View File

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

View File

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

View File

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

View File

@ -59,11 +59,6 @@ interface JsonStorage {
export class DataStoreService { export class DataStoreService {
private static cachePrefix = 'DS:'; 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 /** 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 * and one serialized version in the _serializedStore for the cache. Both should be updated in
* all cases equal! * all cases equal!
@ -115,12 +110,7 @@ export class DataStoreService {
* Empty constructor for dataStore * Empty constructor for dataStore
* @param cacheService use CacheService to cache the DataStore. * @param cacheService use CacheService to cache the DataStore.
*/ */
public constructor(private cacheService: CacheService, private modelMapper: CollectionStringModelMapperService) { public constructor(private cacheService: CacheService, private modelMapper: CollectionStringModelMapperService) {}
if (DataStoreService.wasInstantiated) {
throw new Error('The Datastore should just be instantiated once!');
}
DataStoreService.wasInstantiated = true;
}
/** /**
* Gets the DataStore from cache and instantiate all models out of the serialized version. * 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 { TestBed, inject } from '@angular/core/testing';
import { NotifyService } from './notify.service'; import { NotifyService } from './notify.service';
import { E2EImportsModule } from '../../../e2e-imports.module';
describe('NotifyService', () => { describe('NotifyService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [NotifyService] providers: [NotifyService]
}); });
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,24 +1,48 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 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', () => { describe('SearchValueSelectorComponent', () => {
let component: SearchValueSelectorComponent; @Component({
let fixture: ComponentFixture<SearchValueSelectorComponent>; 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(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [SearchValueSelectorComponent] imports: [E2EImportsModule],
declarations: [TestHostComponent]
}).compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SearchValueSelectorComponent); hostFixture = TestBed.createComponent(TestHostComponent);
component = fixture.componentInstance; hostComponent = hostFixture.componentInstance;
fixture.detectChanges();
}); });
it('should create', () => { 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 { TranslateService } from '@ngx-translate/core';
import { Identifiable } from '../../models/base/identifiable'; import { Identifiable } from '../../models/base/identifiable';
type Selectable = Displayable & Identifiable; export type Selectable = Displayable & Identifiable;
/** /**
* Reusable Searchable Value Selector * Reusable Searchable Value Selector

View File

@ -39,6 +39,8 @@ import { TranslateModule } from '@ngx-translate/core';
// directives // directives
import { PermsDirective } from './directives/perms.directive'; import { PermsDirective } from './directives/perms.directive';
import { DomChangeDirective } from './directives/dom-change.directive'; import { DomChangeDirective } from './directives/dom-change.directive';
// components
import { HeadBarComponent } from './components/head-bar/head-bar.component'; import { HeadBarComponent } from './components/head-bar/head-bar.component';
import { FooterComponent } from './components/footer/footer.component'; import { FooterComponent } from './components/footer/footer.component';
import { LegalNoticeContentComponent } from './components/legal-notice-content/legal-notice-content.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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AgendaListComponent } from './agenda-list.component'; import { AgendaListComponent } from './agenda-list.component';
import { E2EImportsModule } from '../../../../e2e-imports.module';
describe('AgendaListComponent', () => { describe('AgendaListComponent', () => {
let component: AgendaListComponent; let component: AgendaListComponent;
@ -8,6 +9,7 @@ describe('AgendaListComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [E2EImportsModule],
declarations: [AgendaListComponent] declarations: [AgendaListComponent]
}).compileComponents(); }).compileComponents();
})); }));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginMaskComponent } from './login-mask.component'; import { LoginMaskComponent } from './login-mask.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LoginMaskComponent', () => { describe('LoginMaskComponent', () => {
let component: LoginMaskComponent; let component: LoginMaskComponent;
@ -8,7 +9,7 @@ describe('LoginMaskComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [LoginMaskComponent] imports: [E2EImportsModule]
}).compileComponents(); }).compileComponents();
})); }));
@ -21,4 +22,10 @@ describe('LoginMaskComponent', () => {
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginPrivacyPolicyComponent } from './login-privacy-policy.component'; import { LoginPrivacyPolicyComponent } from './login-privacy-policy.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
describe('LoginPrivacyPolicyComponent', () => { describe('LoginPrivacyPolicyComponent', () => {
let component: LoginPrivacyPolicyComponent; let component: LoginPrivacyPolicyComponent;
@ -8,7 +9,7 @@ describe('LoginPrivacyPolicyComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [LoginPrivacyPolicyComponent] imports: [E2EImportsModule]
}).compileComponents(); }).compileComponents();
})); }));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,7 @@ export class UserDetailComponent implements OnInit {
private op: OperatorService private op: OperatorService
) { ) {
this.user = new ViewUser(); 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.newUser = true;
this.setEditMode(true); this.setEditMode(true);
} else { } else {

View File

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

View File

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