-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated unit tests, improved coverage
- Loading branch information
Showing
15 changed files
with
471 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 3 additions & 115 deletions
118
ui/src/app/metadata/configuration/reducer/index.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
ui/src/app/metadata/configuration/reducer/utilities.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import { | ||
getConfigurationSectionsFn, | ||
getLimitedPropertiesFn, | ||
assignValueToProperties | ||
} from './utilities'; | ||
|
||
import { SCHEMA as schema } from '../../../../testing/form-schema.stub'; | ||
import { MockMetadataWizard } from '../../../../testing/mockMetadataWizard'; | ||
|
||
describe('config reducer utilities', () => { | ||
|
||
const model = { | ||
name: 'foo', | ||
serviceEnabled: true, | ||
foo: { | ||
bar: 'bar', | ||
baz: 'baz' | ||
}, | ||
list: [ | ||
'super', | ||
'cool' | ||
] | ||
}; | ||
|
||
const props = [ | ||
{ | ||
id: 'name', | ||
items: null, | ||
name: 'label.metadata-provider-name-dashboard-display-only', | ||
properties: [], | ||
type: 'string', | ||
value: null, | ||
widget: { id: 'string', help: 'message.must-be-unique' } | ||
}, | ||
{ | ||
id: 'serviceEnabled', | ||
items: null, | ||
name: 'serviceEnabled', | ||
properties: [], | ||
type: 'string', | ||
value: null, | ||
widget: { id: 'select', disabled: true } | ||
}, | ||
{ | ||
id: 'foo', | ||
items: null, | ||
name: 'foo', | ||
type: 'object', | ||
properties: [ | ||
{ | ||
id: 'bar', | ||
name: 'bar', | ||
type: 'string', | ||
properties: [] | ||
}, | ||
{ | ||
id: 'baz', | ||
name: 'baz', | ||
type: 'string', | ||
properties: [] | ||
} | ||
] | ||
}, | ||
{ | ||
id: 'list', | ||
name: 'list', | ||
type: 'array', | ||
items: { | ||
type: 'string' | ||
}, | ||
widget: { | ||
id: 'datalist', | ||
data: [ | ||
{ key: 'super', label: 'super' }, | ||
{ key: 'cool', label: 'cool' }, | ||
{ key: 'notcool', label: 'notcool' } | ||
] | ||
} | ||
} | ||
]; | ||
|
||
const definition = MockMetadataWizard; | ||
|
||
describe('assignValueToProperties function', () => { | ||
it('should assign appropriate values to the given schema properties', () => { | ||
const assigned = assignValueToProperties([model], props, definition); | ||
expect(assigned[0].value).toEqual(['foo']); | ||
expect(assigned[1].value).toEqual([true]); | ||
}); | ||
|
||
it('should assign differences when passed multiple models', () => { | ||
const assigned = assignValueToProperties([model, { | ||
...model, | ||
name: 'bar', | ||
list: [ | ||
'super', | ||
'notcool' | ||
] | ||
}], props, definition); | ||
expect(assigned[0].differences).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('getLimitedPropertiesFn function', () => { | ||
it('should filter properties without differences', () => { | ||
const assigned = assignValueToProperties([model, { | ||
...model, | ||
name: 'bar' | ||
}], props, definition); | ||
expect(getLimitedPropertiesFn(assigned).length).toBe(1); | ||
}); | ||
}); | ||
|
||
describe('getConfigurationSectionsFn', () => { | ||
it('should parse the schema, definition, and model into a MetadataConfiguration', () => { | ||
const config = getConfigurationSectionsFn([model], definition, schema); | ||
expect(config.sections).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
ui/src/app/metadata/domain/component/wizard-summary.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="row"> | ||
<div class="col-xl-6 col-xs-12" *ngFor="let sections of columns"> | ||
<section class="px-3" *ngFor="let section of sections; let i = index;"> | ||
<button (click)="gotoPage(section.id)" class="tag tag-success tag-sm my-4 text-left" | ||
[attr.aria-label]="section.label | translate"> | ||
<span class="index">{{ section.pageNumber }}</span> | ||
<translate-i18n [key]="section.label">{{ section.label }}</translate-i18n> | ||
</button> | ||
<ng-container *ngFor="let prop of section.properties"> | ||
<summary-property [property]="prop"></summary-property> | ||
</ng-container> | ||
</section> | ||
</div> | ||
</div> |
Oops, something went wrong.