the test now fails if the tests fails to get into the catch and an item gets cloned

This commit is contained in:
Carlos Jimenez 2018-08-06 14:34:44 +02:00
parent 8228f49eed
commit 1a7930308c
1 changed files with 4 additions and 1 deletions

View File

@ -20,11 +20,14 @@ describe('item clone()', () => {
}); });
it('should attempt to clone the given item but give an error as it doesnt exist', async() => { it('should attempt to clone the given item but give an error as it doesnt exist', async() => {
let result;
try { try {
let itemFk = 999; let itemFk = 999;
await app.models.Item.clone(itemFk); result = await app.models.Item.clone(itemFk);
} catch (error) { } catch (error) {
expect(error.toString()).toContain('Cannot convert undefined or null to object'); expect(error.toString()).toContain('Cannot convert undefined or null to object');
} }
expect(result).toBeFalsy();
}); });
}); });