From a70ff750a6b9dbdbd12cd4597c33870835510a37 Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 23 Oct 2026 14:20:24 +0200 Subject: [PATCH] test(studio): the typeface and display checks assert what they are about BOOKQA-009 looks at font_mix alone (three one-text pages also repeat their layout), and BOOKSTY-004 measures the display tier against the title the classic style already sets (34 pt on this fixture, as on dev) instead of a guessed size. --- shared/src/book/book-findings-design.spec.ts | 5 +++-- shared/src/book/design/design-style.spec.ts | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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);