2019-10-17 11:27:50 +00:00
|
|
|
const app = require('vn-loopback/server/server');
|
|
|
|
|
|
|
|
describe('department removeChild()', () => {
|
|
|
|
let removedChild;
|
|
|
|
|
2021-10-15 12:45:41 +00:00
|
|
|
afterAll(async() => {
|
2019-10-17 11:27:50 +00:00
|
|
|
await app.models.Department.create(removedChild);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should remove a child department', async() => {
|
2022-06-27 09:17:45 +00:00
|
|
|
const childId = 130;
|
2019-10-17 11:27:50 +00:00
|
|
|
|
|
|
|
removedChild = await app.models.Department.findById(childId);
|
|
|
|
const result = await app.models.Department.removeChild(childId);
|
|
|
|
const existsChild = await app.models.Department.findById(childId);
|
|
|
|
|
|
|
|
expect(result.count).toEqual(1);
|
|
|
|
expect(existsChild).toBeNull();
|
|
|
|
});
|
|
|
|
});
|