Fixed tests
This commit is contained in:
parent
800b7536e8
commit
3101d24dbc
|
@ -5,6 +5,7 @@
|
|||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"buildProduction": "ng build -c production",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"extract-i18n": "ng extract-i18n --output-path src/locale"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<app-navigation>
|
||||
z<app-navigation>
|
||||
<router-outlet></router-outlet>
|
||||
</app-navigation>
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
import {TestBed} from '@angular/core/testing';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import {AppComponent} from './app.component';
|
||||
import {NavigationComponent} from "./navigation/navigation.component";
|
||||
import {KeycloakAngularModule} from "keycloak-angular";
|
||||
import {MatSidenavModule} from "@angular/material/sidenav";
|
||||
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
|
||||
import {MatToolbarModule} from "@angular/material/toolbar";
|
||||
import {MatListModule} from "@angular/material/list";
|
||||
import {MatIconModule} from "@angular/material/icon";
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({
|
||||
imports: [RouterTestingModule],
|
||||
declarations: [AppComponent]
|
||||
imports: [RouterTestingModule, KeycloakAngularModule, MatSidenavModule, NoopAnimationsModule,
|
||||
MatToolbarModule, MatListModule, MatIconModule],
|
||||
declarations: [AppComponent, NavigationComponent]
|
||||
}));
|
||||
|
||||
it('should create the app', () => {
|
||||
|
@ -13,17 +21,4 @@ describe('AppComponent', () => {
|
|||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'module-frontend'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('module-frontend');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('module-frontend app is running!');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,5 +6,4 @@ import {Component} from '@angular/core';
|
|||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'module-frontend';
|
||||
}
|
||||
|
|
|
@ -19,9 +19,7 @@ import {MatSidenavModule} from '@angular/material/sidenav';
|
|||
import {MatMenuModule} from "@angular/material/menu";
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {StoreModule} from '@ngrx/store';
|
||||
import {ElectionsModule} from "./elections/elections.module";
|
||||
import {EffectsModule} from '@ngrx/effects';
|
||||
import {MessagesModule} from "./messages/messages.module";
|
||||
|
||||
function initializeKeycloak(keycloak: KeycloakService) {
|
||||
return () =>
|
||||
|
@ -67,7 +65,6 @@ function initializeKeycloak(keycloak: KeycloakService) {
|
|||
MatSidenavModule,
|
||||
MatMenuModule,
|
||||
MatTableModule,
|
||||
MessagesModule,
|
||||
StoreModule.forRoot({}, {}),
|
||||
EffectsModule.forRoot([])
|
||||
],
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
import {TestBed} from '@angular/core/testing';
|
||||
import {CanActivateFn} from '@angular/router';
|
||||
|
||||
import {authGuard} from './auth.guard';
|
||||
|
||||
describe('authGuard', () => {
|
||||
const executeGuard: CanActivateFn = (...guardParameters) =>
|
||||
TestBed.runInInjectionContext(() => authGuard(...guardParameters));
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(executeGuard).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -1,6 +1,9 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectedCandidatesComponent } from './elected-candidates.component';
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {MatSortModule} from "@angular/material/sort";
|
||||
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
|
||||
|
||||
describe('ElectedCandidatesComponent', () => {
|
||||
let component: ElectedCandidatesComponent;
|
||||
|
@ -8,7 +11,10 @@ describe('ElectedCandidatesComponent', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ElectedCandidatesComponent]
|
||||
declarations: [ElectedCandidatesComponent],
|
||||
imports: [
|
||||
MatTableModule, MatSortModule, NoopAnimationsModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ElectedCandidatesComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectionContainerComponent } from './election-container.component';
|
||||
import {RouterTestingModule} from "@angular/router/testing";
|
||||
import {provideMockStore} from "@ngrx/store/testing";
|
||||
import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
|
||||
|
||||
describe('ElectionContainerComponent', () => {
|
||||
let component: ElectionContainerComponent;
|
||||
|
@ -8,7 +11,11 @@ describe('ElectionContainerComponent', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ElectionContainerComponent]
|
||||
declarations: [ElectionContainerComponent],
|
||||
imports: [RouterTestingModule, MatProgressSpinnerModule],
|
||||
providers: [
|
||||
provideMockStore()
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ElectionContainerComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectionResultComponent } from './election-result.component';
|
||||
import {MatTabsModule} from "@angular/material/tabs";
|
||||
import {SeatAllocationComponent} from "../seat-allocation/seat-allocation.component";
|
||||
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {MatSortModule} from "@angular/material/sort";
|
||||
|
||||
describe('ElectionResultComponent', () => {
|
||||
let component: ElectionResultComponent;
|
||||
|
@ -8,7 +13,8 @@ describe('ElectionResultComponent', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ElectionResultComponent]
|
||||
declarations: [ElectionResultComponent, SeatAllocationComponent],
|
||||
imports: [MatTabsModule, NoopAnimationsModule, MatTableModule, MatSortModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(ElectionResultComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
import {TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ElectionService} from './election.service';
|
||||
import {RouterTestingModule} from "@angular/router/testing";
|
||||
import {HttpClientTestingModule} from "@angular/common/http/testing";
|
||||
import {provideMockStore} from "@ngrx/store/testing";
|
||||
|
||||
describe('ElectionService', () => {
|
||||
let service: ElectionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [provideMockStore()]
|
||||
});
|
||||
service = TestBed.inject(ElectionService);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectionComponent } from './election.component';
|
||||
import {ElectionResultComponent} from "../election-result/election-result.component";
|
||||
import {MatTabsModule} from "@angular/material/tabs";
|
||||
import {SeatAllocationComponent} from "../seat-allocation/seat-allocation.component";
|
||||
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
|
||||
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {MatSortModule} from "@angular/material/sort";
|
||||
|
||||
describe('ElectionComponent', () => {
|
||||
let component: ElectionComponent;
|
||||
|
@ -8,7 +15,8 @@ describe('ElectionComponent', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ElectionComponent]
|
||||
declarations: [ElectionComponent, ElectionResultComponent, SeatAllocationComponent],
|
||||
imports: [MatTabsModule, ReactiveFormsModule, NoopAnimationsModule, MatTableModule, MatSortModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(ElectionComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
|
@ -8,19 +8,19 @@ import {electionsReducers, featureStateName} from "./store";
|
|||
import {ElectionsRoutingModule} from "./elections-routing.module";
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
|
||||
import { ElectionComponent } from './election/election.component';
|
||||
import {ElectionComponent} from './election/election.component';
|
||||
import {MatFormFieldModule} from "@angular/material/form-field";
|
||||
import {MatTabsModule} from "@angular/material/tabs";
|
||||
import {MatInputModule} from "@angular/material/input";
|
||||
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
|
||||
import { ElectionContainerComponent } from './election-container/election-container.component';
|
||||
import {ElectionContainerComponent} from './election-container/election-container.component';
|
||||
import {MatButtonModule} from "@angular/material/button";
|
||||
import { ElectionResultComponent } from './election-result/election-result.component';
|
||||
import {ElectionResultComponent} from './election-result/election-result.component';
|
||||
import {MatSortModule} from "@angular/material/sort";
|
||||
import {MatStepperModule} from "@angular/material/stepper";
|
||||
import { SeatAllocationComponent } from './seat-allocation/seat-allocation.component';
|
||||
import {SeatAllocationComponent} from './seat-allocation/seat-allocation.component';
|
||||
import {MatIconModule} from "@angular/material/icon";
|
||||
import { ElectedCandidatesComponent } from './elected-candidates/elected-candidates.component';
|
||||
import {ElectedCandidatesComponent} from './elected-candidates/elected-candidates.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {LandingPageComponent} from './landing-page.component';
|
||||
import {provideMockStore} from "@ngrx/store/testing";
|
||||
import {ElectionsState} from "../store";
|
||||
import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
|
||||
|
||||
describe('ElectionsComponent', () => {
|
||||
describe('LandingPage', () => {
|
||||
let component: LandingPageComponent;
|
||||
let fixture: ComponentFixture<LandingPageComponent>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [LandingPageComponent]
|
||||
declarations: [LandingPageComponent],
|
||||
imports: [MatProgressSpinnerModule],
|
||||
providers: [
|
||||
provideMockStore<ElectionsState>()
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(LandingPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SeatAllocationComponent } from './seat-allocation.component';
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {MatSortModule} from "@angular/material/sort";
|
||||
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
|
||||
|
||||
describe('SeatAllocationComponent', () => {
|
||||
let component: SeatAllocationComponent;
|
||||
|
@ -8,7 +11,8 @@ describe('SeatAllocationComponent', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SeatAllocationComponent]
|
||||
declarations: [SeatAllocationComponent],
|
||||
imports: [MatTableModule, MatSortModule, NoopAnimationsModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(SeatAllocationComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
import {TestBed} from '@angular/core/testing';
|
||||
|
||||
import {MessagesService} from './messages.service';
|
||||
import {provideMockStore} from "@ngrx/store/testing";
|
||||
|
||||
describe('MessagesService', () => {
|
||||
let service: MessagesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
provideMockStore()
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(MessagesService);
|
||||
});
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ import {MatSidenavModule} from '@angular/material/sidenav';
|
|||
import {MatToolbarModule} from '@angular/material/toolbar';
|
||||
|
||||
import {NavigationComponent} from './navigation.component';
|
||||
import {KeycloakAngularModule} from "keycloak-angular";
|
||||
import {RouterTestingModule} from "@angular/router/testing";
|
||||
|
||||
describe('NavigationComponent', () => {
|
||||
let component: NavigationComponent;
|
||||
|
@ -22,6 +24,8 @@ describe('NavigationComponent', () => {
|
|||
MatListModule,
|
||||
MatSidenavModule,
|
||||
MatToolbarModule,
|
||||
KeycloakAngularModule,
|
||||
RouterTestingModule
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue