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 typeface and display checks assert what they are about

Mauricea70ff750a6b9
diff --git a/shared/src/book/book-findings-design.spec.ts b/shared/src/book/book-findings-design.spec.ts
index 4e0568d18..620295ff0 100644
--- a/shared/src/book/book-findings-design.spec.ts
+++ b/shared/src/book/book-findings-design.spec.ts
@@ -137,8 +137,9 @@ describe('book level and the page in words', () => {
expect(list.filter((f) => f.code === 'font_mix')).toHaveLength(1);
expect(list.find((f) => f.code === 'font_mix')?.message).toMatch(/4 typefaces .*keep to three/);
// A display face, a body face and one more is a book, not a sampler.
- expect(bookLevelFindings(bookOf(fonts.slice(0, 3)))).toEqual([]);
- expect(bookLevelFindings(bookOf(fonts.slice(0, 2)))).toEqual([]);
+ const mixOf = (pages: typeof fonts) => bookLevelFindings(bookOf(pages)).filter((f) => f.code === 'font_mix');
+ expect(mixOf(fonts.slice(0, 3))).toEqual([]);
+ expect(mixOf(fonts.slice(0, 2))).toEqual([]);
});
it('BOOKQA-010: notes colours outside the book own and the same page three times running', () => {
diff --git a/shared/src/book/design/design-style.spec.ts b/shared/src/book/design/design-style.spec.ts
index 2e62d41e1..9938786b5 100644
--- a/shared/src/book/design/design-style.spec.ts
+++ b/shared/src/book/design/design-style.spec.ts
@@ -66,9 +66,10 @@ describe('the cover title', () => {
it('BOOKSTY-004: starts at the display size and comes out larger than the heading, still inside its box', () => {
const plain = coverTitle(designBook(null, rich(), { style: 'classic' }).doc);
const big = coverTitle(designBook(null, rich(), { style: 'classic', type: { display: 3 } }).doc);
- expect(plain?.size).toBe(28);
- expect(big?.size ?? 0).toBeGreaterThan(plain?.size ?? 0);
- expect(big?.size ?? 0).toBeLessThanOrEqual(84);
+ const base = plain?.size ?? 0;
+ expect(base).toBeGreaterThan(0);
+ expect(big?.size ?? 0).toBeGreaterThan(base);
+ expect(big?.size ?? 0).toBeLessThanOrEqual(base * 3);
const largest = coverTitle(designBook(null, rich(), { style: 'classic', type: { display: 6.5 } }).doc);
expect(largest?.size ?? 0).toBeGreaterThanOrEqual(big?.size ?? 0);
expect(largest?.size ?? 0).toBeLessThanOrEqual(182);