34 lines
1.8 KiB
JavaScript
34 lines
1.8 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const { fixture } = require('./check-api.cjs');
|
|
(async () => {
|
|
const f = fixture();
|
|
const monday = Date.parse('2026-09-21T04:00:00Z');
|
|
f.info.serverTime = monday;
|
|
f.info.status = 'locked'; f.info.tasks = [];
|
|
delete f.info.startsAt; delete f.info.endsAt;
|
|
let settling = true;
|
|
f.server.intercept = (path, body, ok) => {
|
|
if (path === 'activityConfig/list') {
|
|
assert.deepEqual(body, {});
|
|
ok({ schemaVersion: 1, serverNow: monday, refreshAt: monday + 30000, activities: [
|
|
{ activityId: 'goldMiner', periodId: 'goldMiner:test:future', startsAt: monday + 60000, endsAt: monday + 120000 },
|
|
{ activityId: 'goldMiner', periodId: 'goldMiner:test:monday', startsAt: monday - 1000, endsAt: monday + 60000 }
|
|
] }); return true;
|
|
}
|
|
if (body.action === 'settlements') {
|
|
if (!body.afterId) ok({ status: 'pending_delivery', items: [], nextCursor: 'second' });
|
|
else ok({ status: settling ? 'settling' : 'pending_delivery', items: [], nextCursor: null });
|
|
return true;
|
|
}
|
|
};
|
|
await f.client.refresh();
|
|
assert.equal(f.client.victory(41, false).periodId, 'goldMiner:test:monday');
|
|
f.calls.length = 0; settling = false;
|
|
await f.client.refresh();
|
|
assert.equal(f.calls.find(c => c.body.action === 'settlements').body.afterId, 'second');
|
|
assert(!f.calls.some(c => ['claim', 'ack_settlement', 'confirm_settlement_delivery'].includes(c.body.action)));
|
|
f.client.schedule.activities = [];
|
|
assert.equal(f.client.victory(42, false), null);
|
|
console.log('PASS: Monday temporary period, locked qualification, upcoming filtering, settling cursor retry, no fabricated period.');
|
|
})().catch(error => { console.error(error); process.exitCode = 1; });
|