Skip to content

Commit

Permalink
SHIBUI-986 Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Dec 4, 2018
1 parent 2ec81aa commit e1e4fb7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('Dashboard Resolvers List Page', () => {
it('should route to the wizard page', () => {
spyOn(router, 'navigate');
instance.edit(draft);
expect(router.navigate).toHaveBeenCalledWith(['metadata', 'resolver', 'new', 'blank', 'org-info'], {
expect(router.navigate).toHaveBeenCalledWith(['metadata', 'resolver', 'new', 'blank', 'common'], {
queryParams: { id: '1' }
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('New Resolver Page', () => {
let instance: NewResolverComponent;
let activatedRoute: ActivatedRouteStub = new ActivatedRouteStub();
activatedRoute.testParamMap = { id: 'foo', events: of({}) };
activatedRoute.data = of('foo');

beforeEach(() => {
TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ import { Component, ViewChild } from '@angular/core';
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule, Store, combineReducers } from '@ngrx/store';

import { NgbDropdownModule, NgbPopoverModule, NgbModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { RouterStateSnapshot } from '@angular/router';
import { NgbDropdownModule, NgbPopoverModule, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';

import { ResolverWizardComponent } from './resolver-wizard.component';
import * as fromRoot from '../reducer';
import { WizardModule } from '../../../wizard/wizard.module';
import { WizardSummaryComponent } from '../../domain/component/wizard-summary.component';
import { SummaryPropertyComponent } from '../../domain/component/summary-property.component';
import * as fromWizard from '../../../wizard/reducer';
import { MockI18nModule } from '../../../../testing/i18n.stub';
import { METADATA_SOURCE_WIZARD } from '../wizard-definition';
import { MetadataSourceWizard } from '../../domain/model/wizards/metadata-source-wizard';
import { initialState } from '../reducer/entity.reducer';
import { MockWizardModule } from '../../../../testing/wizard.stub';
import { RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';

import { NgbModalStub } from '../../../../testing/modal.stub';
import { of } from 'rxjs';
import { MetadataResolver } from '../../domain/model';
import { DifferentialService } from '../../../core/service/differential.service';

@Component({
template: `
Expand Down Expand Up @@ -94,6 +92,7 @@ describe('Resolver Wizard Component', () => {
TestHostComponent
],
providers: [
DifferentialService,
{ provide: NgbModal, useClass: NgbModalStub },
{ provide: METADATA_SOURCE_WIZARD, useValue: MetadataSourceWizard }
]
Expand Down
11 changes: 11 additions & 0 deletions ui/src/testing/activated-route.stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { convertToParamMap, ParamMap, ActivatedRoute } from '@angular/router';
import { Observable, of } from 'rxjs';

@Injectable()
export class ActivatedRouteStub {
Expand All @@ -16,6 +17,8 @@ export class ActivatedRouteStub {

private _firstChild: ActivatedRouteStub;

private _data: Observable<any>;

get testParamMap() { return this._testParamMap; }
set testParamMap(params: {}) {
this._testParamMap = convertToParamMap(params);
Expand Down Expand Up @@ -44,4 +47,12 @@ export class ActivatedRouteStub {
set firstChild(stub: ActivatedRouteStub) {
this._firstChild = stub;
}

get data(): Observable<any> {
return this._data;
}

set data(d: Observable<any>) {
this._data = d;
}
}

0 comments on commit e1e4fb7

Please sign in to comment.