Browse Source

Tests fixed.

pull/336/head
Sebastian Stehle 8 years ago
parent
commit
45d4637e09
  1. 2
      src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts
  2. 4
      src/Squidex/app/features/administration/state/event-consumers.state.spec.ts
  3. 2
      src/Squidex/app/features/settings/pages/backups/backups-page.component.ts
  4. 8
      src/Squidex/app/shared/state/backups.state.spec.ts
  5. 2
      src/Squidex/app/shared/state/backups.state.ts

2
src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts

@ -35,7 +35,7 @@ export class EventConsumersPageComponent implements OnDestroy, OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.eventConsumersState.load(false, true).pipe(onErrorResumeNext()).subscribe(); this.eventConsumersState.load().pipe(onErrorResumeNext()).subscribe();
this.timerSubscription = this.timerSubscription =
timer(2000, 2000).pipe(switchMap(x => this.eventConsumersState.load(true, true).pipe(onErrorResumeNext()))) timer(2000, 2000).pipe(switchMap(x => this.eventConsumersState.load(true, true).pipe(onErrorResumeNext())))

4
src/Squidex/app/features/administration/state/event-consumers.state.spec.ts

@ -64,11 +64,11 @@ describe('EventConsumersState', () => {
dialogs.verify(x => x.notifyError(It.isAny()), Times.once()); dialogs.verify(x => x.notifyError(It.isAny()), Times.once());
}); });
it('should not show notification on load error when flag is false', () => { it('should not show notification on load error when silent is true', () => {
eventConsumersService.setup(x => x.getEventConsumers()) eventConsumersService.setup(x => x.getEventConsumers())
.returns(() => throwError({})); .returns(() => throwError({}));
eventConsumersState.load().pipe(onErrorResumeNext()).subscribe(); eventConsumersState.load(true, true).pipe(onErrorResumeNext()).subscribe();
expect().nothing(); expect().nothing();

2
src/Squidex/app/features/settings/pages/backups/backups-page.component.ts

@ -34,7 +34,7 @@ export class BackupsPageComponent implements OnInit, OnDestroy {
} }
public ngOnInit() { public ngOnInit() {
this.backupsState.load(false, true).pipe(onErrorResumeNext()).subscribe(); this.backupsState.load().pipe(onErrorResumeNext()).subscribe();
this.timerSubscription = this.timerSubscription =
timer(3000, 3000).pipe(switchMap(t => this.backupsState.load(true, true).pipe(onErrorResumeNext()))) timer(3000, 3000).pipe(switchMap(t => this.backupsState.load(true, true).pipe(onErrorResumeNext())))

8
src/Squidex/app/shared/state/backups.state.spec.ts

@ -63,22 +63,22 @@ describe('BackupsState', () => {
dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once());
}); });
it('should show notification on load error when silent is true', () => { it('should show notification on load error when silent is false', () => {
backupsService.setup(x => x.getBackups(app)) backupsService.setup(x => x.getBackups(app))
.returns(() => throwError({})); .returns(() => throwError({}));
backupsState.load(true, true).pipe(onErrorResumeNext()).subscribe(); backupsState.load(true, false).pipe(onErrorResumeNext()).subscribe();
expect().nothing(); expect().nothing();
dialogs.verify(x => x.notifyError(It.isAny()), Times.once()); dialogs.verify(x => x.notifyError(It.isAny()), Times.once());
}); });
it('should not show notification on load error when flag is false', () => { it('should not show notification on load error when silent is true', () => {
backupsService.setup(x => x.getBackups(app)) backupsService.setup(x => x.getBackups(app))
.returns(() => throwError({})); .returns(() => throwError({}));
backupsState.load().pipe(onErrorResumeNext()).subscribe(); backupsState.load(true, true).pipe(onErrorResumeNext()).subscribe();
expect().nothing(); expect().nothing();

2
src/Squidex/app/shared/state/backups.state.ts

@ -66,7 +66,7 @@ export class BackupsState extends State<Snapshot> {
}); });
}), }),
catchError(error => { catchError(error => {
if (silent) { if (!silent) {
this.dialogs.notifyError(error); this.dialogs.notifyError(error);
} }

Loading…
Cancel
Save