- 重构报销状态注册表、审批流路由与平台风险标记 - 完善管家意图规划器与模型计划构建器全链路 - 新增 OCR Worker 脚本、数据库会话管理与通知状态 - 优化文档中心、日志视图、预算中心与员工管理交互 - 增强工作台摘要、图标资源与全局主题样式 - 补充审批路由、状态注册、OCR 服务与管家规划器测试覆盖
21 lines
733 B
JavaScript
21 lines
733 B
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import {
|
|
NOTIFICATION_STATE_BATCH_SIZE,
|
|
chunkNotificationStatePatches
|
|
} from '../src/services/notificationStates.js'
|
|
|
|
test('notification state patches are split before posting to backend', () => {
|
|
const patches = Array.from({ length: 205 }, (_, index) => ({
|
|
notification_id: `document:owned:DOC-${index + 1}`,
|
|
read: true
|
|
}))
|
|
const chunks = chunkNotificationStatePatches(patches)
|
|
|
|
assert.equal(NOTIFICATION_STATE_BATCH_SIZE, 100)
|
|
assert.deepEqual(chunks.map((chunk) => chunk.length), [100, 100, 5])
|
|
assert.equal(chunks[0][0].notification_id, 'document:owned:DOC-1')
|
|
assert.equal(chunks[2][4].notification_id, 'document:owned:DOC-205')
|
|
})
|