统一前后端代码格式化配置

This commit is contained in:
yml2213
2026-08-16 17:27:12 +08:00
parent 8705f6a6a1
commit 5c7c3e14e3
278 changed files with 6386 additions and 5500 deletions
@@ -4,9 +4,11 @@ import test from 'node:test'
import { resolveIndustryVoucherForTask } from './consume-on-deliver.js'
import type { KuaishouIndustryVoucherRow } from '../../types/repository/rows.js'
function voucher(partial: Partial<KuaishouIndustryVoucherRow> & {
voucher_code: string
}): KuaishouIndustryVoucherRow {
function voucher(
partial: Partial<KuaishouIndustryVoucherRow> & {
voucher_code: string
},
): KuaishouIndustryVoucherRow {
return {
id: partial.id || 1,
oid: partial.oid || 'OID-1',
@@ -43,18 +45,14 @@ test('resolveIndustryVoucherForTask prefers task_id over unit_index', () => {
})
test('resolveIndustryVoucherForTask falls back to unit_index when task_id missing', () => {
const vouchers = [
voucher({ id: 1, voucher_code: 'A', task_id: null, unit_index: 2 }),
]
const vouchers = [voucher({ id: 1, voucher_code: 'A', task_id: null, unit_index: 2 })]
const matched = resolveIndustryVoucherForTask({ id: 99, unit_index: 2 }, vouchers)
assert.equal(matched?.voucher_code, 'A')
})
test('resolveIndustryVoucherForTask returns null when no match', () => {
const vouchers = [
voucher({ id: 1, voucher_code: 'A', task_id: 1, unit_index: 1 }),
]
const vouchers = [voucher({ id: 1, voucher_code: 'A', task_id: 1, unit_index: 1 })]
assert.equal(resolveIndustryVoucherForTask({ id: 2, unit_index: 3 }, vouchers), null)
})