From 492aa1e850fc45ecf07ff1925c65f1f5b91161a4 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Wed, 12 Jun 2019 10:15:33 +0100 Subject: [PATCH] fix flaky test upload service --- lib/core/services/upload.service.spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/core/services/upload.service.spec.ts b/lib/core/services/upload.service.spec.ts index 5e4ecaadf5..b3190ec4a7 100644 --- a/lib/core/services/upload.service.spec.ts +++ b/lib/core/services/upload.service.spec.ts @@ -16,7 +16,7 @@ */ import { EventEmitter } from '@angular/core'; -import { TestBed } from '@angular/core/testing'; +import { async, TestBed } from '@angular/core/testing'; import { FileModel, FileUploadOptions, FileUploadStatus } from '../models/file.model'; import { AppConfigModule } from '../app-config/app-config.module'; import { UploadService } from './upload.service'; @@ -278,30 +278,30 @@ describe('UploadService', () => { expect(result[0]).toBe(file4); }); - it('should call onUploadDeleted if file was deleted', () => { + it('should call onUploadDeleted if file was deleted', async(() => { const file = ({ status: FileUploadStatus.Deleted }); spyOn(service.fileUploadDeleted, 'next'); service.cancelUpload(file); expect(service.fileUploadDeleted.next).toHaveBeenCalled(); - }); + })); - it('should call fileUploadError if file has error status', () => { + it('should call fileUploadError if file has error status', async(() => { const file = ({ status: FileUploadStatus.Error }); spyOn(service.fileUploadError, 'next'); service.cancelUpload(file); expect(service.fileUploadError.next).toHaveBeenCalled(); - }); + })); - it('should call fileUploadCancelled if file is in pending', () => { + it('should call fileUploadCancelled if file is in pending', async(() => { const file = ({ status: FileUploadStatus.Pending }); spyOn(service.fileUploadCancelled, 'next'); service.cancelUpload(file); expect(service.fileUploadCancelled.next).toHaveBeenCalled(); - }); + })); });