| 1 |
import Helper, { states } from "./_helper"; |
| 2 |
|
| 3 |
describe("External | Shared | ORM | Belongs To | Reflexive | delete", () => { |
| 4 |
let helper; |
| 5 |
beforeEach(() => { |
| 6 |
helper = new Helper(); |
| 7 |
}); |
| 8 |
afterEach(() => { |
| 9 |
helper.shutdown(); |
| 10 |
}); |
| 11 |
|
| 12 |
states.forEach((state) => { |
| 13 |
test(`deleting the parent updates the child's foreign key for a ${state}`, () => { |
| 14 |
let [user, targetUser] = helper[state](); |
| 15 |
|
| 16 |
if (targetUser) { |
| 17 |
targetUser.destroy(); |
| 18 |
user.reload(); |
| 19 |
} |
| 20 |
|
| 21 |
expect(user.userId).toBeNil(); |
| 22 |
expect(user.user).toBeNil(); |
| 23 |
}); |
| 24 |
}); |
| 25 |
}); |