830f8a4011
Memind CI / Test, build, and release guards (push) Successful in 5m36s
Ship the 10-item numeric subscription loop on WeChat MP, wire schedule delivery for news/weather/quote/health/finance/tech/knowledge/night/surprise pushes, and extend news morning draft cover generation plus a one-shot draft push script. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
864 B
JavaScript
29 lines
864 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
formatDailySurpriseDeliveryText,
|
|
formatSurprisePushDelivery,
|
|
} from './daily-surprise-library.mjs';
|
|
|
|
test('formatDailySurpriseDeliveryText returns stable daily surprise', () => {
|
|
const text = formatDailySurpriseDeliveryText({
|
|
userId: 'user-surprise',
|
|
timezone: 'Asia/Shanghai',
|
|
now: Date.parse('2026-09-20T18:00:00+08:00'),
|
|
});
|
|
assert.match(text, /^🎁 每日惊喜/u);
|
|
assert.match(text, /取消10/u);
|
|
});
|
|
|
|
test('formatSurprisePushDelivery falls back to library without news page', async () => {
|
|
const delivery = await formatSurprisePushDelivery({
|
|
userId: 'user-surprise',
|
|
now: Date.parse('2026-09-20T18:00:00+08:00'),
|
|
timezone: 'Asia/Shanghai',
|
|
h5Root: '/tmp/empty',
|
|
env: {},
|
|
});
|
|
assert.match(delivery.text, /每日惊喜/u);
|
|
});
|