From b3d30a834e719519b4cfe1194206d735ad830c8b Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 24 Oct 2026 19:38:07 +0200 Subject: [PATCH] test(studio): pin which texts count as a template's figures --- shared/src/book/templates/template-words.spec.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shared/src/book/templates/template-words.spec.ts b/shared/src/book/templates/template-words.spec.ts index ee3e307b4..9754d35a7 100644 --- a/shared/src/book/templates/template-words.spec.ts +++ b/shared/src/book/templates/template-words.spec.ts @@ -1,10 +1,10 @@ import { bookSpreadSchema, bookTextElementSchema, type BookSpread, type BookTextElement } from '../book.schema'; import type { BookTemplateTextRole } from './template-format'; -import { assignTemplateTexts, bookTemplateWords } from './template-words'; +import { assignTemplateTexts, bookTemplateWords, isTemplateFigureText } from './template-words'; import { describe, expect, it } from 'vitest'; -// TPLWORDS-001 to TPLWORDS-006 +// TPLWORDS-001 to TPLWORDS-007 /** * Which of a page's words a template's roles take: the journal's bindings @@ -57,6 +57,15 @@ describe('the page words in the roles', () => { const spare = assignTemplateTexts([text('a', 'One'), text('b', 'Two'), text('c', 'Three')], new Set(['title'])); expect(ids(spare)).toEqual({ title: 'a' }); }); + + it('TPLWORDS-007: takes the figures a template drew for its design, never a date or a bound text', () => { + expect(isTemplateFigureText(text('tc', '00:12:48:03'))).toBe(true); + expect(isTemplateFigureText(text('frame', '21'))).toBe(true); + expect(isTemplateFigureText(text('day', '12.08.2025'))).toBe(false); + expect(isTemplateFigureText(text('year', '2027'))).toBe(false); + expect(isTemplateFigureText(text('word', 'REC'))).toBe(false); + expect(isTemplateFigureText(text('bound', '14', { binding: { source: 'entry.title', entryId: 1 } }))).toBe(false); + }); }); describe('the book words for the roles a page has none for', () => {