Files
splatoon3.ink/workers/updater/schedule.spec.mjs
Matt Isenhower 73f4d403bd Replace the quick/default/all update modes with lane run options
The modes mostly chose which lane's updaters ran, which the lanes now decide. The fast
lane keeps one option, translations (quick runs at :00-:04 skip them); the slow lane has
none. Runs, slots and manual requests carry the option instead of a mode, and the admin
panel shows runs as quick or full, with an "Include translations" box for manual fast
runs. Slots and runs saved with a mode run with the defaults.

The Node runner follows the same cadence: npm run splatnet:quick is the fast lane without
translations, splatnet the fast lane, and splatnet:all both lanes. The unused disableXRank
and disableFestivalRankings settings are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:39:16 -08:00

27 lines
1.5 KiB
JavaScript

import { describe, expect, it } from 'vitest';
import { LANE_SCHEDULES, nextSlot } from './src/schedule.mjs';
import { nextRefreshAt } from './src/RegionAuth.mjs';
const at = time => Date.parse(`2026-11-08T${time}Z`);
describe('lane schedules', () => {
it('runs quick updates through the first minutes of the hour, then default updates', () => {
expect(nextSlot(LANE_SCHEDULES.fast, at('11:59:59'))).toEqual({ at: at('12:00:15'), options: { translations: false } });
expect(nextSlot(LANE_SCHEDULES.fast, at('12:00:15'))).toEqual({ at: at('12:01:15'), options: { translations: false } });
expect(nextSlot(LANE_SCHEDULES.fast, at('12:04:30'))).toEqual({ at: at('12:05:15'), options: { translations: true } });
expect(nextSlot(LANE_SCHEDULES.fast, at('12:20:15'))).toEqual({ at: at('12:30:15'), options: { translations: true } });
expect(nextSlot(LANE_SCHEDULES.fast, at('12:45:15'))).toEqual({ at: at('13:00:15'), options: { translations: false } });
});
it('runs the slow lane hourly', () => {
expect(nextSlot(LANE_SCHEDULES.slow, at('12:00:00'))).toEqual({ at: at('12:20:45'), options: {} });
expect(nextSlot(LANE_SCHEDULES.slow, at('12:20:45'))).toEqual({ at: at('13:20:45'), options: {} });
});
it('refreshes each region\'s credentials at a different minute after :35', () => {
expect(nextRefreshAt('US', at('12:00:00'))).toBe(at('12:35:00'));
expect(nextRefreshAt('AP', at('12:00:00'))).toBe(at('12:38:00'));
expect(nextRefreshAt('US', at('12:35:00'))).toBe(at('13:35:00'));
});
});