Skip to content

Commit

Permalink
SHIBUI-1270 Fixed existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jul 16, 2019
1 parent 339c49e commit 226e377
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class TestHostComponent {
@ViewChild(ArrayPropertyComponent)
public componentUnderTest: ArrayPropertyComponent;

property: Property = getStepProperty(SCHEMA.properties.list, {
property: Property = getStepProperty(SCHEMA.properties.list, [{
name: 'foo',
type: 'baz',
description: 'foo bar baz',
list: []
}, SCHEMA.definitions);
}], SCHEMA.definitions);

setProperty(property: Property): void {
this.property = property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { MockI18nModule } from '../../../../testing/i18n.stub';
})
class ObjectPropertyComponent {
@Input() property: Property;
@Input() columns = 1;
}

@Component({
Expand All @@ -25,7 +26,10 @@ class TestHostComponent {
@ViewChild(MetadataConfigurationComponent)
public componentUnderTest: MetadataConfigurationComponent;

configuration: MetadataConfiguration = {sections: []};
configuration: MetadataConfiguration = {
dates: [],
sections: []
};
}

describe('Metadata Configuration Component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class TestHostComponent {
@ViewChild(ConfigurationComponent)
public componentUnderTest: ConfigurationComponent;

configuration: MetadataConfiguration = { sections: [] };
configuration: MetadataConfiguration = {
dates: [],
sections: []
};
}

describe('Metadata Configuration Page Component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { MetadataHistoryService } from '../service/history.service';
import { of } from 'rxjs';
import { StoreModule, combineReducers } from '@ngrx/store';
import * as fromConfiguration from '../reducer';
import { Router, ActivatedRoute } from '@angular/router';
import { RouterStub } from '../../../../testing/router.stub';
import { ActivatedRouteStub } from '../../../../testing/activated-route.stub';

export const TestData = {
versions: [
Expand Down Expand Up @@ -43,6 +46,12 @@ describe('Metadata Version History Component', () => {
providers: [
{
provide: MetadataHistoryService, useValue: MockHistoryService
},
{
provide: Router, useClass: RouterStub
},
{
provide: ActivatedRoute, useClass: ActivatedRouteStub
}
],
imports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ class TestHostComponent {
@ViewChild(MetadataOptionsComponent)
public componentUnderTest: MetadataOptionsComponent;

configuration: MetadataConfiguration = { sections: [] };
configuration: MetadataConfiguration = {
dates: [],
sections: []
};
}

describe('Metadata Options Page Component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { MetadataXmlComponent } from './metadata-xml.component';
class TestHostComponent {
@ViewChild(MetadataXmlComponent)
public componentUnderTest: MetadataXmlComponent;

configuration: MetadataConfiguration = { sections: [] };
}

describe('Metadata Xml Page Component', () => {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/configuration/reducer/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Configuration Reducer', () => {

describe('getConfigurationSectionsFn', () => {
it('should parse the schema, definition, and model into a MetadataConfiguration', () => {
const config = getConfigurationSectionsFn(model, definition, schema);
const config = getConfigurationSectionsFn([model], definition, schema);
expect(config.sections).toBeDefined();
});
});
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/configuration/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const assignValueToProperties = (models, properties): any[] => {
export const getConfigurationSectionsFn = (models, definition, schema): MetadataConfiguration => {
return !definition || !schema ? null :
({
dates: models.map(m => m.updatedDate),
dates: models.map(m => m.modifiedDate),
sections: definition.steps
.filter(step => step.id !== 'summary')
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ describe('Resolver Reducer', () => {
describe('Select Resolver', () => {
it('should update the selected draft id', () => {
let id = 'foo',
createdDate = new Date().toDateString(),
expected = { ...snapshot, selectedResolverId: id };
const action = new resolverActions.SelectResolver(id);
const action = new resolverActions.SelectResolverSuccess({ id, createdDate } as MetadataResolver);
const result = reducer({ ...snapshot }, action);

expect(result).toEqual(
Object.assign({}, initialState, expected)
);
expect(result.selectedResolverId).toEqual(id);
expect(result.ids.length).toBe(3);
});
});
});

0 comments on commit 226e377

Please sign in to comment.