23 lines
670 B
JavaScript
23 lines
670 B
JavaScript
const app = require('vn-loopback/server/server');
|
|
|
|
describe('department moveChild()', () => {
|
|
let updatedChild;
|
|
|
|
afterAll(async() => {
|
|
const child = await app.models.Department.findById(updatedChild.id);
|
|
await child.updateAttribute('parentFk', null);
|
|
});
|
|
|
|
it('should move a child department to a new parent', async() => {
|
|
const childId = 22;
|
|
const parentId = 37;
|
|
|
|
const child = await app.models.Department.findById(childId);
|
|
|
|
expect(child.parentFk).toEqual(1);
|
|
updatedChild = await app.models.Department.moveChild(childId, parentId);
|
|
|
|
expect(updatedChild.parentFk).toEqual(37);
|
|
});
|
|
});
|