Skip to content

Commit

Permalink
SHIBUI-1281 Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jun 21, 2019
1 parent ae984cc commit 230b3fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ describe('Configuration Reducer', () => {
const model: MetadataResolver = {
id: 'foo',
serviceProviderName: 'foo',
'@type': 'MetadataResolver'
'@type': 'MetadataResolver',
createdBy: 'admin'
};
const xml = `<entity-descriptor></entity-descriptor>`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { Router } from '@angular/router';
import { Router, RouterModule } from '@angular/router';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { StoreModule, Store, combineReducers } from '@ngrx/store';
import { NgbPaginationModule, NgbModal, NgbModalModule, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
Expand All @@ -13,6 +13,7 @@ import { FileBackedHttpMetadataResolver } from '../../domain/entity';
import { DashboardResolversListComponent } from './dashboard-resolvers-list.component';
import { MockI18nModule } from '../../../../testing/i18n.stub';
import { CustomDatePipe } from '../../../shared/pipe/date.pipe';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';


describe('Dashboard Resolvers List Page', () => {
Expand Down Expand Up @@ -48,7 +49,9 @@ describe('Dashboard Resolvers List Page', () => {
ReactiveFormsModule,
NgbPaginationModule,
NgbModalModule,
MockI18nModule
MockI18nModule,
InfiniteScrollModule,
RouterModule
],
declarations: [
DashboardResolversListComponent,
Expand All @@ -73,23 +76,6 @@ describe('Dashboard Resolvers List Page', () => {
expect(fixture).toBeDefined();
});

xdescribe('getPagedResolvers method', () => {});

describe('changePage method', () => {
it('should update the page value', () => {
let page = 2;
instance.changePage(page);
expect(instance.page).toBe(page);
});

it('should update the paged resolvers list', () => {
let page = 2;
spyOn(instance, 'getPagedResolvers');
instance.changePage(page);
expect(instance.getPagedResolvers).toHaveBeenCalled();
});
});

describe('toggleResolver method', () => {
it('should fire a redux action', () => {
instance.toggleEntity(draft);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('Provider Collection Reducer', () => {
name: 'name',
'@type': 'foo',
enabled: true,
createdBy: 'admin',
createdDate: new Date().toLocaleDateString(),
sortKey: 1,
xmlId: 'foo',
Expand All @@ -34,6 +35,7 @@ describe('Provider Collection Reducer', () => {
name: 'bar',
'@type': 'bar',
enabled: false,
createdBy: 'admin',
createdDate: new Date().toLocaleDateString(),
sortKey: 2,
xmlId: 'bar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ describe('Resolver Wizard Step Component', () => {
...initialState,
changes: {
id: 'foo',
serviceProviderName: 'bar'
serviceProviderName: 'bar',
createdBy: 'admin'
}
}
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ describe('Resolver Wizard Component', () => {
...initialState,
changes: {
id: 'foo',
serviceProviderName: 'bar'
serviceProviderName: 'bar',
createdBy: 'admin'
}
}
}),
Expand Down Expand Up @@ -126,7 +127,7 @@ describe('Resolver Wizard Component', () => {
}));

it('should open a modal', () => {
app.changes = {id: 'bar', serviceProviderName: 'foo'};
app.changes = {id: 'bar', serviceProviderName: 'foo', createdBy: 'admin'};
spyOn(modal, 'open').and.callThrough();
app.canDeactivate(null, null, {
url: 'foo'
Expand Down

0 comments on commit 230b3fb

Please sign in to comment.