Files
zkxw/web-admin/src/utils/oa-confirmation-date.test.ts
T
zlwuandCursor b1b15da624 feat(oa): add confirmation date month-add helper for 转正套件
Also add the confirmation kit implementation plan.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 17:19:09 +08:00

23 lines
625 B
TypeScript

import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { addMonthsYmd } from './oa-confirmation-date'
describe('addMonthsYmd', () => {
it('simple month add', () => {
assert.equal(addMonthsYmd('2026-01-15', 3), '2026-04-15')
})
it('clamp end of month', () => {
assert.equal(addMonthsYmd('2026-01-31', 1), '2026-02-28')
})
it('zero months returns same day', () => {
assert.equal(addMonthsYmd('2026-07-30', 0), '2026-07-30')
})
it('invalid => null', () => {
assert.equal(addMonthsYmd('', 3), null)
assert.equal(addMonthsYmd('2026-01-15', -1), null)
})
})