diff --git a/services/loopback/common/methods/item/specs/clone.spec.js b/services/loopback/common/methods/item/specs/clone.spec.js index 816a94e7b..137fbc792 100644 --- a/services/loopback/common/methods/item/specs/clone.spec.js +++ b/services/loopback/common/methods/item/specs/clone.spec.js @@ -20,14 +20,14 @@ describe('item clone()', () => { }); it('should attempt to clone the given item but give an error as it doesnt exist', async() => { - let result; - try { - let itemFk = 999; - result = await app.models.Item.clone(itemFk); - } catch (error) { - expect(error.toString()).toContain('Cannot convert undefined or null to object'); - } + let error; + let itemFk = 999; + await app.models.Item.clone(itemFk) + .catch(e => { + expect(e.message).toContain('Cannot convert undefined or null to object'); + error = e; + }); - expect(result).toBeFalsy(); + expect(error).toBeDefined(); }); });