mirror of
https://github.com/docmost/docmost.git
synced 2026-09-11 07:56:54 +08:00
test: add page hierarchy cycle integration harness
This commit is contained in:
@@ -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' },
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user