style: 统一代码格式化与代码规范

This commit is contained in:
yml2213
2026-09-19 10:41:15 +08:00
parent c62c8c2cad
commit 8631100d07
6 changed files with 38 additions and 19 deletions
@@ -3,13 +3,26 @@ import test from 'node:test'
import { readFile } from 'node:fs/promises'
const FULFILLMENT_SERVICE = new URL('./consignment-fulfillment-service.ts', import.meta.url)
const GIFT_REPO = new URL('../../repositories/worker-platform/work-order-gift-repo.ts', import.meta.url)
const GIFT_REPO = new URL(
'../../repositories/worker-platform/work-order-gift-repo.ts',
import.meta.url,
)
test('内部现货履约必须将工单发单金额更新为寄卖成本价并记录留痕', async () => {
const source = await readFile(FULFILLMENT_SERVICE, 'utf8')
assert.ok(source.includes('const previousRewardAmountFen = Number(lockedOrder.reward_amount || 0)'))
assert.ok(source.includes('const costPriceFen = Math.max(0, Math.round(Number(inv.cost_price_fen || 0)))'))
assert.ok(source.includes('const effectiveRewardAmountFen = costPriceFen > 0 ? costPriceFen : previousRewardAmountFen'))
assert.ok(
source.includes('const previousRewardAmountFen = Number(lockedOrder.reward_amount || 0)'),
)
assert.ok(
source.includes(
'const costPriceFen = Math.max(0, Math.round(Number(inv.cost_price_fen || 0)))',
),
)
assert.ok(
source.includes(
'const effectiveRewardAmountFen = costPriceFen > 0 ? costPriceFen : previousRewardAmountFen',
),
)
assert.ok(source.includes('previousRewardAmountFen,'))
assert.ok(source.includes('rewardAmountFen: effectiveRewardAmountFen,'))
assert.ok(source.includes('updatedRewardAmountFen: effectiveRewardAmountFen,'))
@@ -642,4 +642,3 @@ test('品类隔离门禁:苏尔南手枪现货绝不匹配特种兵密钥、
assert.ok(matched)
assert.equal(matched.matchType, 'partial') // 2璀璨充0璀璨
})
@@ -66,12 +66,12 @@ export function normalizePeacekeeperSeries(value: string): string {
/** 常见商品品类主体定义 */
export type ItemCategoryType =
| 'pistol_skin' // 手枪/苏尔南/枪皮
| 'key_secret' // 特种兵密钥/钥匙
| 'cannon' // 爆破型肩炮/肩甲
| 'gift_box' // 专属礼盒/宝箱/福袋
| 'rename_card' // 改名卡/更名卡
| 'diamond_topup' // 钻石/点券/充值
| 'pistol_skin' // 手枪/苏尔南/枪皮
| 'key_secret' // 特种兵密钥/钥匙
| 'cannon' // 爆破型肩炮/肩甲
| 'gift_box' // 专属礼盒/宝箱/福袋
| 'rename_card' // 改名卡/更名卡
| 'diamond_topup' // 钻石/点券/充值
| 'other'
export function detectItemCategory(text: string): ItemCategoryType {