22 lines
627 B
JavaScript
22 lines
627 B
JavaScript
const app = require('vn-loopback/server/server');
|
|
|
|
describe('department removeChild()', () => {
|
|
let removedChild;
|
|
|
|
afterAll(async done => {
|
|
await app.models.Department.create(removedChild);
|
|
done();
|
|
});
|
|
|
|
it('should remove a child department', async() => {
|
|
const childId = 1;
|
|
|
|
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();
|
|
});
|
|
});
|