fix: make order processing authorized and recoverable
This commit is contained in:
1 parent
0ab7d62aa6
commit
7e42a6dcc6
15 files changed
+219
-129
No files matched your search
@@ -2,9 +2,9 @@
|
||||
const {test}=require('node:test');const assert=require('node:assert/strict');
|
||||
const {windowForCutoff,upcomingWindow,inWindow}=require('../../src/modules/order-rules/window.cjs');
|
||||
const schedule={times:['11:00','17:00'],timezone:'Asia/Shanghai',weekends:false};
|
||||
test('normal weekday only includes same-day first interval or interval between send times',()=>{
|
||||
test('normal weekday first interval continuously covers prior evening',()=>{
|
||||
const morning=windowForCutoff('2026-10-20T03:00:00Z',schedule),afternoon=windowForCutoff('2026-10-20T09:00:00Z',schedule);
|
||||
assert.equal(morning.start,'2026-10-19T16:00:00.000Z');assert.equal(morning.end,'2026-10-20T03:00:00.000Z');
|
||||
assert.equal(morning.start,'2026-10-19T09:00:00.000Z');assert.equal(morning.end,'2026-10-20T03:00:00.000Z');
|
||||
assert.equal(afternoon.start,'2026-10-20T03:00:00.000Z');assert.equal(afternoon.end,'2026-10-20T09:00:00.000Z');
|
||||
assert.equal(inWindow('2026-10-19T08:00:00Z',morning),false);
|
||||
assert.equal(inWindow('2026-10-20T03:00:00Z',morning),false);assert.equal(inWindow('2026-10-20T03:00:00Z',afternoon),true);
|
||||
|
||||
Reference in new issue
Block a user