-
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.
- Loading branch information
Showing
21 changed files
with
351 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { reducer } from './configuration.reducer'; | ||
import * as fromConfiguration from './configuration.reducer'; | ||
import * as actions from '../action/configuration.action'; | ||
|
||
describe('Configuration Reducer', () => { | ||
const initialState: fromConfiguration.ConfigState = { | ||
roles: [] | ||
}; | ||
|
||
describe('undefined action', () => { | ||
it('should return the default state', () => { | ||
const result = reducer(undefined, {} as any); | ||
expect(result).toEqual(initialState); | ||
}); | ||
}); | ||
|
||
describe('Role Load Request', () => { | ||
it('should set fetching to true', () => { | ||
const action = new actions.LoadRoleSuccess(['ADMIN']); | ||
const result = reducer(initialState, action); | ||
expect(result).toEqual( | ||
{ | ||
...initialState, | ||
roles: ['ADMIN'] | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
describe('selector functions', () => { | ||
it('should return the roles from state', () => { | ||
expect(fromConfiguration.getRoles(initialState)).toEqual([]); | ||
}); | ||
}); | ||
}); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; | ||
import { Property } from '../../domain/model/property'; | ||
import { MockI18nModule } from '../../../../testing/i18n.stub'; | ||
import { SCHEMA } from '../../../../testing/form-schema.stub'; | ||
import { getStepProperty } from '../../domain/utility/configuration'; | ||
import { FilterTargetPropertyComponent } from './filter-target-property.component'; | ||
import { PrimitivePropertyComponent } from './primitive-property.component'; | ||
import { ArrayPropertyComponentStub, PrimitivePropertyComponentStub } from '../../../../testing/property-component.stub'; | ||
import { AttributesService } from '../../domain/service/attributes.service'; | ||
import { of } from 'rxjs'; | ||
|
||
@Component({ | ||
template: ` | ||
<filter-target-property [property]="property"></filter-target-property> | ||
` | ||
}) | ||
class TestHostComponent { | ||
@ViewChild(FilterTargetPropertyComponent) | ||
public componentUnderTest: FilterTargetPropertyComponent; | ||
|
||
property: Property = getStepProperty(SCHEMA.properties.formatFilterTarget, { | ||
formatFilterTargetType: 'ENTITY_ID', | ||
value: [ | ||
'foo', | ||
'bar', | ||
'baz' | ||
] | ||
}, SCHEMA.definitions); | ||
} | ||
|
||
describe('Filter Target Property Component', () => { | ||
|
||
let fixture: ComponentFixture<TestHostComponent>; | ||
let instance: TestHostComponent; | ||
let app: FilterTargetPropertyComponent; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
NgbPopoverModule, | ||
MockI18nModule, | ||
RouterTestingModule | ||
], | ||
declarations: [ | ||
FilterTargetPropertyComponent, | ||
PrimitivePropertyComponentStub, | ||
ArrayPropertyComponentStub, | ||
TestHostComponent | ||
], | ||
providers: [] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TestHostComponent); | ||
instance = fixture.componentInstance; | ||
app = instance.componentUnderTest; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should accept a property input', async(() => { | ||
expect(app).toBeTruthy(); | ||
})); | ||
}); |
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
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
6 changes: 3 additions & 3 deletions
6
ui/src/app/metadata/configuration/component/object-property.component.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
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
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
Oops, something went wrong.