抽出日期计算纯函数模块,并搭建后端测试基建

- 新增 server/src/occurrence.js:startOfDay/getNextOccurrence/daysBetween,today 可注入
- reminder.js 改为调用新模块,删除内联的 getThisYearDate/daysBetween
- 引入 node:test 作为测试框架,加 npm test 脚本
- 新增 test/helper.js(临时库辅助,供后续任务用)和 test/occurrence.test.js(7 个用例,覆盖农历跨年等边界)
This commit is contained in:
yuming
2026-08-15 17:30:42 +08:00
parent c92df874d1
commit 68acbb3809
5 changed files with 111 additions and 37 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "node --watch src/index.js"
"dev": "node --watch src/index.js",
"test": "node --test test/"
},
"dependencies": {
"axios": "^1.7.7",