Files
memind/wechat/health-reminder-library.test.mjs
john 830f8a4011
Memind CI / Test, build, and release guards (push) Successful in 5m36s
feat(wechat): add service-account push subscriptions and news morning cover delivery
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>
2026-09-20 16:15:15 +08:00

27 lines
882 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {
formatHealthReminderDeliveryText,
pickHealthReminder,
resolveHealthReminderSlot,
} from './health-reminder-library.mjs';
test('resolveHealthReminderSlot maps hour ranges', () => {
assert.equal(resolveHealthReminderSlot(8), 'morning');
assert.equal(resolveHealthReminderSlot(14), 'afternoon');
assert.equal(resolveHealthReminderSlot(20), 'evening');
assert.equal(resolveHealthReminderSlot(2), 'general');
});
test('formatHealthReminderDeliveryText uses slot by hour', () => {
const morning = formatHealthReminderDeliveryText({
userId: 'user-h',
hour: 10,
now: Date.parse('2026-09-20T10:00:00+08:00'),
});
assert.match(morning, /^🏃 健康提醒/u);
assert.match(morning, /取消8/u);
assert.ok(pickHealthReminder({ userId: 'user-h', hour: 10 }).length > 5);
});