Daily Bluesky bot for AT Mot. Invites players and congratulates yesterday's solvers.
1import { describe, it, expect } from 'vitest';
2import { EPOCH_UTC_MS, puzzleNumberFor, daysSinceEpoch, puzzleTarget } from '../src/config.js';
3
4describe('puzzle numbering', () => {
5 it('epoch day is puzzle #1', () => {
6 expect(puzzleNumberFor(EPOCH_UTC_MS)).toBe(1);
7 expect(daysSinceEpoch(EPOCH_UTC_MS)).toBe(0);
8 });
9
10 it('four days after epoch is puzzle #5', () => {
11 expect(puzzleNumberFor(Date.UTC(2026, 5, 27))).toBe(5);
12 });
13
14 it('only changes at UTC midnight, not mid-day', () => {
15 const lateInEpochDay = EPOCH_UTC_MS + 23 * 3_600_000;
16 expect(puzzleNumberFor(lateInEpochDay)).toBe(1);
17 });
18
19 it('days before the epoch are < 1 (no puzzle yet)', () => {
20 expect(puzzleNumberFor(Date.UTC(2026, 5, 22))).toBe(0);
21 });
22});
23
24describe('puzzleTarget format (frozen)', () => {
25 it('builds the canonical permalink', () => {
26 expect(puzzleTarget('en', 5)).toBe('https://atmot.herve.bzh/p/en/5');
27 expect(puzzleTarget('fr', 12)).toBe('https://atmot.herve.bzh/p/fr/12');
28 });
29});