refactor of spec file

This commit is contained in:
Carlos Jimenez 2018-08-23 09:09:37 +02:00
parent be85c784ed
commit d8075a09e2
1 changed files with 8 additions and 8 deletions

View File

@ -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();
});
});