// 为日期格式化函数编写测试用例 import {expect, test} from '@jest/globals'; import { parseTime } from './klp.js' test('formatDate', () => { expect(parseTime('2023-12-25', '{y}-{m}-{d}')).toBe('2023-12-25') }) test('formatDate with custom format', () => { const date = new Date('2023-12-25') expect(parseTime(date, '{y}年{m}月{d}日')).toBe('2023年12月25日') })