test: pin the reattachment count to active descendants (#393)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m9s
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m9s
A deactivated child of the reattached category is not counted in the number of categories put back, which the Journal line reports. Resolves #393 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bad53fe85b
commit
8a9d9909f9
1 changed files with 8 additions and 2 deletions
|
|
@ -358,8 +358,14 @@ describe("reattachCategory on rows already in a cycle (#393)", () => {
|
|||
expect(db.writes()).toEqual(["BEGIN", "ROLLBACK", "BEGIN", "ROLLBACK"]);
|
||||
});
|
||||
|
||||
it("reattaches a category whose parent was deleted", async () => {
|
||||
const db = useFakeDb([row(1, null), row(2, null, { is_active: 0 }), row(20, 2), row(21, 20)]);
|
||||
it("reattaches a category whose parent was deleted, counting its active descendants only", async () => {
|
||||
const db = useFakeDb([
|
||||
row(1, null),
|
||||
row(2, null, { is_active: 0 }),
|
||||
row(20, 2),
|
||||
row(21, 20),
|
||||
row(22, 20, { is_active: 0 }),
|
||||
]);
|
||||
expect(await reattachCategory(20, 1)).toBe(2);
|
||||
expect(db.rows().find((r) => r.id === 20)?.parent_id).toBe(1);
|
||||
expect(await findOrphanCategories()).toEqual([]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue