Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import App from './App'
import { createDailyPuzzle, LATEST_DAILY_DATE } from './lib/daily'
import App, { historyPageSize } from './App'
import { AVAILABLE_DAILY_DATES, createDailyPuzzle, LATEST_DAILY_DATE } from './lib/daily'
import { calculateScore } from './lib/puzzle'

const latestDailyDate = LATEST_DAILY_DATE
Expand Down Expand Up @@ -63,6 +63,23 @@ const renderDaily = (date = gameplayDailyDate) => {
return render(<App />)
}

const historyPathForDate = (date: string) => {
const newestFirstDates = [...AVAILABLE_DAILY_DATES].reverse()
const dateIndex = newestFirstDates.indexOf(date)

if (dateIndex < 0) {
throw new Error(`Daily puzzle ${date} is not available`)
}

const page = Math.floor(dateIndex / historyPageSize) + 1
return page === 1 ? '/' : `/?page=${page}`
}

const renderHomeWithHistoryDate = (date = gameplayDailyDate) => {
window.history.replaceState(null, '', historyPathForDate(date))
return render(<App />)
}

const stubClipboard = () => {
const writeText = vi.fn().mockResolvedValue(undefined)
Object.defineProperty(navigator, 'clipboard', {
Expand Down Expand Up @@ -370,7 +387,7 @@ describe('Lexi Tiles app', () => {
hintedWords: ['everywhere', 'where'],
})

render(<App />)
renderHomeWithHistoryDate()

const gameplayEntry = screen.getByTestId(`history-entry-${gameplayDailyDate}`)
expect(within(gameplayEntry).getByText('Progress 2/24')).toBeInTheDocument()
Expand Down Expand Up @@ -415,8 +432,7 @@ describe('Lexi Tiles app', () => {
expect(savedProgress.hintedWords[0]).toEqual(expect.any(String))

dailySession.unmount()
window.history.replaceState(null, '', '/')
render(<App />)
renderHomeWithHistoryDate()

const gameplayEntry = screen.getByTestId(`history-entry-${gameplayDailyDate}`)
expect(within(gameplayEntry).getByText('Hints 1')).toBeInTheDocument()
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import './App.css'

const progressCookiePrefix = 'lexi_tiles_progress_'
const dailyPathPattern = /^\/daily\/(\d{4}-\d{2}-\d{2})\/?$/
const historyPageSize = 7
export const historyPageSize = 7

type StatusKind = 'info' | 'success' | 'error'

Expand Down
35 changes: 35 additions & 0 deletions src/data/daily-puzzles.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,5 +453,40 @@
"ty"
]
]
},
{
"date": "2026-05-09",
"quartets": [
[
"comm",
"uni",
"cat",
"ion"
],
[
"rel",
"ig",
"io",
"us"
],
[
"re",
"la",
"ti",
"ve"
],
[
"ind",
"iv",
"idu",
"ally"
],
[
"po",
"ssib",
"ili",
"ty"
]
]
}
]
5 changes: 5 additions & 0 deletions src/data/generated-daily-puzzles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ export const DAILY_PUZZLES = [
quartets: [["na","ti","on","al"],["su","pe","rvi","sor"],["di","sap","pea","ring"],["indi","vid","ua","lly"],["fa","ci","li","ty"]],
words: ['cion', 'city', 'dial', 'dilly', 'disappearing', 'facial', 'facility', 'faring', 'individually', 'lion', 'livid', 'nape', 'nation', 'national', 'pea', 'peal', 'peaty', 'penally', 'peon', 'ring', 'sap', 'sully', 'supervisor', 'tiring', 'type'],
},
{
date: '2026-05-09',
quartets: [["comm","uni","cat","ion"],["rel","ig","io","us"],["re","la","ti","ve"],["ind","iv","idu","ally"],["po","ssib","ili","ty"]],
words: ['ally', 'cat', 'cation', 'catty', 'communication', 'community', 'individually', 'ion', 'lati', 'lave', 'pore', 'possibility', 'really', 'relative', 'religion', 'religious', 'tire', 'typo', 'uni', 'unitive', 'unity', 'vela'],
},
] as const