* 支持当前页下载状态的手动和定时检测,仅显示标签与检测时间 * 区分查件时间和下载点击时间,保留重复查件前的取件时间 * 将查件事件按时间并入现有取件记录,共用展开与收起 * 统一表头居中,支持拖拽和键盘调整列宽并限制最小宽度 * 修复筛选面板收起结束时顶部间距突然消失的顿挫 * 补充单元、集成与浏览器验证,覆盖查询下载、列宽和动画行为
26 lines
1.3 KiB
JavaScript
26 lines
1.3 KiB
JavaScript
import { test } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { queriedAt, formatRecordTime, markRecordRetrieved } from '../src/utils/receive-record.ts'
|
|
|
|
test('legacy lookup dates never imply a retrieval happened', () => {
|
|
const record = { date: '2026/9/18 15:08:09' }
|
|
assert.equal(queriedAt(record), record.date)
|
|
assert.equal(formatRecordTime(queriedAt(record)), record.date)
|
|
assert.equal(formatRecordTime(record.retrievedAt), '')
|
|
})
|
|
test('download click updates retrieval independently of query and legacy timestamps', () => {
|
|
const record = { date: 'legacy', queriedAt: '2026-09-18T07:00:00.000Z' }
|
|
markRecordRetrieved(record, new Date('2026-09-18T07:01:00Z'))
|
|
assert.equal(record.retrievedAt, '2026-09-18T07:01:00.000Z')
|
|
markRecordRetrieved(record, new Date('2026-09-18T07:02:00Z'))
|
|
assert.equal(record.retrievedAt, '2026-09-18T07:02:00.000Z')
|
|
assert.equal(queriedAt(record), '2026-09-18T07:00:00.000Z')
|
|
assert.equal(record.date, 'legacy')
|
|
})
|
|
test('ISO dates display in local time while invalid legacy values are preserved', () => {
|
|
const iso = '2026-09-18T07:00:00.000Z'
|
|
assert.equal(formatRecordTime(iso), new Date(iso).toLocaleString())
|
|
assert.equal(formatRecordTime('2026-99-99T00:00:00Z'), '2026-99-99T00:00:00Z')
|
|
assert.equal(formatRecordTime(null), '')
|
|
})
|