Skip to content
Open
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
19 changes: 18 additions & 1 deletion scripts/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Personalizer, collectThemes, normalizeTheme } from '../src/personalize.js';
import { SearchIndex, tokenize, snippet } from '../src/search.js';
import { asMovements, monthByNumber, movementOf, mirrorOf, currentMonth, neighbors } from '../src/journey.js';
import { asMovements, monthByNumber, monthsOfMovement, movementOf, mirrorOf, currentMonth, neighbors } from '../src/journey.js';

const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const { articles } = JSON.parse(
Expand Down Expand Up @@ -111,6 +111,23 @@ check('neighbors are the adjacent months, with no wraparound', () => {
assert.equal(neighbors(arc, 12).next, null);
});

check('monthsOfMovement returns the months of a movement in calendar order', () => {
const ground = monthsOfMovement(arc, 'ground');
assert.deepEqual(ground.map((m) => m.number), [1, 2, 3, 4, 5]);
const presence = monthsOfMovement(arc, 'presence');
assert.deepEqual(presence.map((m) => m.number), [6, 7, 8]);
});

check('movementOf resolves correctly when called with a month number', () => {
assert.equal(movementOf(arc, 8).id, 'presence');
assert.equal(movementOf(arc, 9).id, 'forward');
});

check('mirrorOf returns null for a month with no mirror partner', () => {
assert.equal(mirrorOf(arc, 6), null);
assert.equal(mirrorOf(arc, 99), null);
});

console.log('personalize.js (more)');

check('reading an article adds the seen penalty and reason', () => {
Expand Down
Loading