From c204359811add310d8f6f0cc1fd71e1cc336d90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 4 Nov 2016 14:51:02 +0100 Subject: [PATCH] Fix npm test --- .../hal-resources/work-package-resource.service.test.ts | 4 +++- .../api-v3/hal-resources/work-package-resource.service.ts | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.test.ts b/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.test.ts index 60ab914d82..ba90adc8d2 100644 --- a/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.test.ts +++ b/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.test.ts @@ -144,7 +144,9 @@ describe('WorkPackageResource service', () => { const expectCacheUpdate = () => { it('should update the work package cache', () => { - expect(updateWorkPackageStub.calledWith(workPackage)).to.be.true; + result.then(() => { + expect(updateWorkPackageStub.calledWith(workPackage)).to.be.true; + }); }); }; diff --git a/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts b/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts index f10062a187..b618e57824 100644 --- a/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts +++ b/frontend/app/components/api/api-v3/hal-resources/work-package-resource.service.ts @@ -475,9 +475,12 @@ export class WorkPackageResource extends HalResource { resources[name] = linked ? linked.$update() : $q.reject(); }); - return $q.all(resources).then(() => { + const promise = $q.all(resources) + promise.then(() => { wpCacheService.updateWorkPackage(this); }); + + return promise; } /**