#524 backend clone.js unit tests
This commit is contained in:
parent
7367792d91
commit
084896c69a
|
@ -12,10 +12,19 @@ describe('item clone()', () => {
|
||||||
nextItemId = nextAvailableId.id;
|
nextItemId = nextAvailableId.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should', async() => {
|
it('should clone the given item and it should have the expected id', async() => {
|
||||||
let itemFk = 1;
|
let itemFk = 1;
|
||||||
let result = await app.models.Item.clone(itemFk);
|
let result = await app.models.Item.clone(itemFk);
|
||||||
|
|
||||||
expect(result).toEqual(nextItemId);
|
expect(result).toEqual(nextItemId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should attempt to clone the given item but give an error as it doesnt exist', async() => {
|
||||||
|
try {
|
||||||
|
let itemFk = 999;
|
||||||
|
await app.models.Item.clone(itemFk);
|
||||||
|
} catch (error) {
|
||||||
|
expect(error.toString()).toContain('Cannot convert undefined or null to object');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue