Skip to content

Commit

Permalink
SHIBUI-716 Fixed issue with duplicate id validation for providers
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 7, 2018
1 parent 15e46af commit 8d61a4e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
13 changes: 11 additions & 2 deletions ui/src/app/metadata/domain/effect/entity.effect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EntityIdService } from '../service/entity-id.service';
import { ResolverService } from '../service/resolver.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NgbModalStub } from '../../../../testing/modal.stub';
import { EntityAttributesFilterEntity } from '../entity';
import { EntityAttributesFilterEntity, FileBackedHttpMetadataResolver } from '../entity';

describe('Entity Effects', () => {
let effects: EntityEffects;
Expand Down Expand Up @@ -45,13 +45,22 @@ describe('Entity Effects', () => {
});

describe('openModal', () => {
it('should open a modal window', fakeAsync(() => {
it('should open a modal window for a filter', fakeAsync(() => {
spyOn(modal, 'open').and.returnValue({componentInstance: <any>{}});
spyOn(idService, 'preview').and.returnValue(of('<foo></foo>'));
effects.openModal(new EntityAttributesFilterEntity());
expect(idService.preview).toHaveBeenCalled();
tick(10);
expect(modal.open).toHaveBeenCalled();
}));

it('should open a modal window for a provider', fakeAsync(() => {
spyOn(modal, 'open').and.returnValue({ componentInstance: <any>{} });
spyOn(providerService, 'preview').and.returnValue(of('<foo></foo>'));
effects.openModal(new FileBackedHttpMetadataResolver());
expect(providerService.preview).toHaveBeenCalled();
tick(10);
expect(modal.open).toHaveBeenCalled();
}));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ export class ProviderWizardStepComponent implements OnDestroy {
this.definition$ = this.store.select(fromWizard.getWizardDefinition);
this.changes$ = this.store.select(fromProvider.getEntityChanges);

this.validators$ = this.store.select(fromProvider.getProviderNames).pipe(
withLatestFrom(this.definition$),
map(([names, def]) => def.getValidators(names))
this.validators$ = this.definition$.pipe(
withLatestFrom(
this.store.select(fromProvider.getProviderNames),
this.store.select(fromProvider.getProviderXmlIds),
),
map(([def, names, ids]) => def.getValidators(
names,
ids
))
);

this.model$ = this.schema$.pipe(
Expand Down

0 comments on commit 8d61a4e

Please sign in to comment.