fixed tests

This commit is contained in:
Giuseppe Digilio
2020-12-04 09:22:31 +01:00
parent c841a135c9
commit 30d4c6ab5a
2 changed files with 16 additions and 8 deletions

View File

@@ -152,29 +152,33 @@ describe('ResourcePolicyCreateComponent test suite', () => {
fixture.destroy(); fixture.destroy();
}); });
it('should init component properly', () => { it('should init component properly', (done) => {
fixture.detectChanges(); fixture.detectChanges();
expect(compAsAny.targetResourceUUID).toBe('itemUUID'); expect(compAsAny.targetResourceUUID).toBe('itemUUID');
expect(compAsAny.targetResourceName).toBe('test item'); expect(compAsAny.targetResourceName).toBe('test item');
done();
}); });
it('should redirect to authorizations page', () => { it('should redirect to authorizations page', (done) => {
comp.redirectToAuthorizationsPage(); comp.redirectToAuthorizationsPage();
expect(compAsAny.router.navigate).toHaveBeenCalled(); expect(compAsAny.router.navigate).toHaveBeenCalled();
done();
}); });
it('should return true when is Processing', () => { it('should return true when is Processing', (done) => {
compAsAny.processing$.next(true); compAsAny.processing$.next(true);
expect(comp.isProcessing()).toBeObservable(cold('a', { expect(comp.isProcessing()).toBeObservable(cold('a', {
a: true a: true
})); }));
done();
}); });
it('should return false when is not Processing', () => { it('should return false when is not Processing', (done) => {
compAsAny.processing$.next(false); compAsAny.processing$.next(false);
expect(comp.isProcessing()).toBeObservable(cold('a', { expect(comp.isProcessing()).toBeObservable(cold('a', {
a: false a: false
})); }));
done();
}); });
describe('when target type is group', () => { describe('when target type is group', () => {

View File

@@ -137,28 +137,32 @@ describe('ResourcePolicyEditComponent test suite', () => {
fixture.destroy(); fixture.destroy();
}); });
it('should init component properly', () => { it('should init component properly', (done) => {
fixture.detectChanges(); fixture.detectChanges();
expect(compAsAny.resourcePolicy).toEqual(resourcePolicy); expect(compAsAny.resourcePolicy).toEqual(resourcePolicy);
done();
}); });
it('should redirect to authorizations page', () => { it('should redirect to authorizations page', (done) => {
comp.redirectToAuthorizationsPage(); comp.redirectToAuthorizationsPage();
expect(compAsAny.router.navigate).toHaveBeenCalled(); expect(compAsAny.router.navigate).toHaveBeenCalled();
done();
}); });
it('should return true when is Processing', () => { it('should return true when is Processing', (done) => {
compAsAny.processing$.next(true); compAsAny.processing$.next(true);
expect(comp.isProcessing()).toBeObservable(cold('a', { expect(comp.isProcessing()).toBeObservable(cold('a', {
a: true a: true
})); }));
done();
}); });
it('should return false when is not Processing', () => { it('should return false when is not Processing', (done) => {
compAsAny.processing$.next(false); compAsAny.processing$.next(false);
expect(comp.isProcessing()).toBeObservable(cold('a', { expect(comp.isProcessing()).toBeObservable(cold('a', {
a: false a: false
})); }));
done();
}); });
describe('', () => { describe('', () => {