| 1 |
import Helper, { states } from "./_helper"; |
| 2 |
|
| 3 |
describe("External | Shared | ORM | Has Many | Named One-Way 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 children updates the parent's foreign key for a ${state}`, () => { |
| 14 |
let [tag, labels] = helper[state](); |
| 15 |
|
| 16 |
if (labels && labels.length) { |
| 17 |
labels.forEach((t) => t.destroy()); |
| 18 |
tag.reload(); |
| 19 |
} |
| 20 |
|
| 21 |
expect(tag.labels).toHaveLength(0); |
| 22 |
expect(tag.labelIds).toHaveLength(0); |
| 23 |
}); |
| 24 |
}); |
| 25 |
}); |