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