test: add page hierarchy cycle integration harness

This commit is contained in:
Philipinho
2026-09-01 22:35:30 +01:00
parent dc8ed0ff06
commit 3e87ce9514
6 changed files with 223 additions and 0 deletions
@@ -0,0 +1,21 @@
import { db } from './support/database';
import { seedAcyclicPageChain } from './support/page-hierarchy-fixtures';
describe('page hierarchy cycle integration harness', () => {
it('inserts and reads an acyclic page chain through the test Kysely instance', async () => {
const { root, child, grandchild } = await seedAcyclicPageChain();
const pages = await db
.selectFrom('pages')
.select(['id', 'parentPageId', 'title'])
.where('id', 'in', [root.id, child.id, grandchild.id])
.orderBy('title')
.execute();
expect(pages).toEqual([
{ id: child.id, parentPageId: root.id, title: 'Child' },
{ id: grandchild.id, parentPageId: child.id, title: 'Grandchild' },
{ id: root.id, parentPageId: null, title: 'Root' },
]);
});
});