import assert from 'node:assert/strict' import test from 'node:test' import { syncKuaishouCloudTaskStateForTask } from './kuaishou-cloud-task-state-repo.js' test('syncKuaishouCloudTaskStateForTask 将 Date 更新时间规范化为 ISO 字符串', async () => { const calls: Array<{ text: string; params?: unknown[] }> = [] const executor = async (text: string, params?: unknown[]) => { calls.push({ text, params }) return { rows: [] } } await syncKuaishouCloudTaskStateForTask({ taskId: 9, executorKey: 'kuaishou_ct_assisted', contextJson: { kuaishouCloudFulfillment: { ticket: { status: 'verified', code: '597172E91CF18417', }, binding: { bindUrl: 'https://example.test/bind', vnPhone: '14062706492', roleName: '测试角色', roleId: '4212063544', resolvedSourceKey: 'account_test', }, dispatch: { status: 'pending', }, consume: { status: 'pending', }, }, }, updatedAt: new Date('2026-05-29T09:05:46.658Z'), }, executor) assert.equal(calls.length, 1) assert.match(calls[0].text, /INSERT INTO kuaishou_cloud_task_states/) assert.equal(calls[0].params?.[10], '2026-05-29T09:05:46.658Z') })