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 pattern picker test counts the tiles against BOOK_PATTERNS

Maurice1be997f7d8cb
diff --git a/client/tests/unit/studio/paintPicker.test.tsx b/client/tests/unit/studio/paintPicker.test.tsx
index 59b91916d..cd65cbdd0 100644
--- a/client/tests/unit/studio/paintPicker.test.tsx
+++ b/client/tests/unit/studio/paintPicker.test.tsx
@@ -1,4 +1,4 @@
-import type { BookPaint } from '@trek/shared';
+import { BOOK_PATTERNS, type BookPaint } from '@trek/shared';
import { useState } from 'react';
import { describe, expect, it, vi } from 'vitest';
import { StudioPaintPicker } from '../../../src/components/Studio/StudioPaintPicker';
@@ -172,7 +172,7 @@ describe('a pattern', () => {
it('draws a tile for each repeat, turns stripes to the diagonal, and lets the ground go', () => {
const channel = spy();
const { container } = render(<Harness start={start} channel={channel} />);
- expect(container.querySelectorAll('.st-pattern-tile')).toHaveLength(12);
+ expect(container.querySelectorAll('.st-pattern-tile')).toHaveLength(BOOK_PATTERNS.length);
expect(need(container.querySelector('.st-pattern-tile[aria-checked="true"]')).getAttribute('aria-label')).toBe(
'journey.studio.pattern.dots'
);
@@ -182,7 +182,7 @@ describe('a pattern', () => {
fireEvent.click(need(container.querySelector('[role="switch"]')));
expect(last(channel.commit)).toMatchObject({ bg: null });
- expect(container.querySelectorAll('.st-pattern-tile.is-clear')).toHaveLength(12);
+ expect(container.querySelectorAll('.st-pattern-tile.is-clear')).toHaveLength(BOOK_PATTERNS.length);
fireEvent.click(need(container.querySelector('[role="switch"]')));
expect(last(channel.commit)).toMatchObject({ bg: '#ffffff' });
});