diff --git a/ui/src/app/metadata/configuration/component/filter-version-list.component.spec.ts b/ui/src/app/metadata/configuration/component/filter-version-list.component.spec.ts
new file mode 100644
index 000000000..8cb39402d
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-version-list.component.spec.ts
@@ -0,0 +1,85 @@
+import { Component, ViewChild } from '@angular/core';
+import { TestBed, ComponentFixture } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+
+import { MockI18nModule } from '../../../../testing/i18n.stub';
+import { FilterVersionListComponent } from './filter-version-list.component';
+import { FilterComparison } from '../model/compare';
+import { FilterConfiguration } from '../model/metadata-configuration';
+
+export const TestData = {
+ dates: ['abc', '123'],
+ filters: [
+ {
+ resourceId: 'foo',
+ name: 'Test 1',
+ type: 'EntityAttributesFilter',
+ comparable: false
+ },
+ {
+ resourceId: 'bar',
+ name: 'Test 2',
+ type: 'EntityAttributesFilter',
+ comparable: false
+ }
+ ]
+};
+
+@Component({
+ template: `
+
+
+ `
+})
+class TestHostComponent {
+ @ViewChild(FilterVersionListComponent)
+ public componentUnderTest: FilterVersionListComponent;
+
+ filters: FilterConfiguration = TestData;
+
+ compare(versions: FilterComparison): void { }
+}
+
+describe('Filter Version List Component', () => {
+ let fixture: ComponentFixture;
+ let instance: TestHostComponent;
+ let list: FilterVersionListComponent;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [],
+ imports: [
+ MockI18nModule,
+ RouterTestingModule
+ ],
+ declarations: [
+ FilterVersionListComponent,
+ TestHostComponent
+ ],
+ });
+
+ fixture = TestBed.createComponent(TestHostComponent);
+ instance = fixture.componentInstance;
+ list = instance.componentUnderTest;
+ fixture.detectChanges();
+ });
+
+ it('should compile', () => {
+ expect(list).toBeDefined();
+ });
+
+ /*
+ describe('compareSelected', () => {
+ it('should emit an event with the selected filter data', () => {
+ list.selected = 'foo';
+ fixture.detectChanges();
+ spyOn(instance, 'compare');
+ list.compareSelected();
+ fixture.detectChanges();
+ expect(instance.compare).toHaveBeenCalled();
+ });
+ });
+ */
+});
diff --git a/ui/src/app/metadata/configuration/model/version.ts b/ui/src/app/metadata/configuration/model/version.ts
index 5d1e1dac5..bba3c7ced 100644
--- a/ui/src/app/metadata/configuration/model/version.ts
+++ b/ui/src/app/metadata/configuration/model/version.ts
@@ -5,7 +5,7 @@ export interface MetadataVersion {
}
export interface FilterVersion {
- id: string;
+ resourceId: string;
name: string;
type: string;
comparable: boolean;
diff --git a/ui/src/app/metadata/configuration/reducer/filter.reducer.spec.ts b/ui/src/app/metadata/configuration/reducer/filter.reducer.spec.ts
new file mode 100644
index 000000000..228c705f1
--- /dev/null
+++ b/ui/src/app/metadata/configuration/reducer/filter.reducer.spec.ts
@@ -0,0 +1,93 @@
+import { reducer } from './filter.reducer';
+import * as fromFilterCompare from './filter.reducer';
+import {
+ SetFilterComparisonSchema,
+ ClearFilterComparison,
+ SetFilterComparisonDefinition,
+ CompareFilterVersions
+} from '../action/filter.action';
+import { NameIDFilterConfiguration } from '../../filter/model/nameid-configuration.filter';
+import { Metadata } from '../../domain/domain.type';
+
+describe('Filter Comparison Reducer', () => {
+ const initialState: fromFilterCompare.State = { ...fromFilterCompare.initialState };
+
+ describe('undefined action', () => {
+ it('should return the default state', () => {
+ const result = reducer(undefined, {} as any);
+
+ expect(result).toEqual(initialState);
+ });
+ });
+
+ describe('SET_SCHEMA action', () => {
+ it('should add the provided schema to the state', () => {
+ const schema = {type: 'object', properties: { foo: { type: 'string' } }};
+ const action = new SetFilterComparisonSchema(schema);
+ const result = reducer(initialState, action);
+ expect(result.schema).toEqual(schema);
+ });
+ });
+
+ describe('SET_DEFINITION action', () => {
+ it('should add the provided definition to the state', () => {
+ const definition = NameIDFilterConfiguration;
+ const action = new SetFilterComparisonDefinition(definition);
+ const result = reducer(initialState, action);
+ expect(result.definition).toEqual(definition);
+ });
+ });
+
+ describe('COMPARE_FILTERS action', () => {
+ it('should add model information to the state', () => {
+ const request = {
+ modelId: 'foo',
+ modelType: 'EntityAttributesFilter',
+ models: [{}, {}] as Metadata[]
+ };
+ const action = new CompareFilterVersions(request);
+ const result = reducer(initialState, action);
+ expect(result.modelId).toEqual(request.modelId);
+ expect(result.modelType).toEqual(request.modelType);
+ expect(result.models).toEqual(request.models);
+ });
+ });
+
+ describe('CLEAR action', () => {
+ it('should reset to the initial state', () => {
+ const action = new ClearFilterComparison();
+ const result = reducer(initialState, action);
+ expect(result).toEqual(initialState);
+ });
+ });
+
+ describe('selector functions', () => {
+ describe('getModel', () => {
+ it('should retrieve the model from state', () => {
+ const models = [{}, {}] as Metadata[];
+ expect(fromFilterCompare.getModelId({ ...initialState, modelId: 'foo' })).toBe('foo');
+ expect(fromFilterCompare.getModelType({ ...initialState, modelType: 'foo' })).toBe('foo');
+ expect(fromFilterCompare.getModels({ ...initialState, models })).toBe(models);
+ });
+ });
+ describe('getLoading', () => {
+ it('should retrieve the loading state', () => {
+ expect(fromFilterCompare.getLoading({ ...initialState, loading: true })).toBe(true);
+ });
+ });
+
+ describe('getSchema', () => {
+ it('should retrieve the schema from state', () => {
+ const schema = {};
+ expect(fromFilterCompare.getSchema({ ...initialState, schema })).toBe(schema);
+ });
+ });
+
+ describe('getDefinition', () => {
+ it('should retrieve the definition from state', () => {
+ const definition = NameIDFilterConfiguration;
+ expect(fromFilterCompare.getDefinition({ ...initialState, definition })).toBe(NameIDFilterConfiguration);
+ });
+ });
+ });
+});