Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(studio): the auto layout lays out a long journey whole

Mauricead721a1ac691
diff --git a/client/tests/unit/studio/autoLayout.travel.test.ts b/client/tests/unit/studio/autoLayout.travel.test.ts
index c66aa97b8..9c69fb885 100644
--- a/client/tests/unit/studio/autoLayout.travel.test.ts
+++ b/client/tests/unit/studio/autoLayout.travel.test.ts
@@ -268,9 +268,11 @@ describe('the entry spreads', () => {
})
describe('the document as a whole', () => {
- it('stays within the schema cap on spreads', () => {
+ it('lays out a long journey whole, its last page and back cover after the entries', () => {
const many = Array.from({ length: 200 }, (_, i) => entry({ id: i + 1 }))
- expect(build({ entries: many }).spreads.length).toBeLessThanOrEqual(150)
+ const doc = build({ entries: many })
+ expect(doc.spreads.length).toBeGreaterThan(150)
+ expect(doc.spreads.slice(-2).map(sp => sp.role)).toEqual(['last', 'back'])
})
it('gives every spread and every element an id of its own', () => {