Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
修复billing货币格式化测试中USD符号在多locale
DavidShenc52192c20c41
diff --git a/apps/desktop/src/renderer/features/billing/__tests__/money.test.ts b/apps/desktop/src/renderer/features/billing/__tests__/money.test.tsindex 6451c13da5..3cd8dd83ad 100644--- a/apps/desktop/src/renderer/features/billing/__tests__/money.test.ts+++ b/apps/desktop/src/renderer/features/billing/__tests__/money.test.ts@@ -4,15 +4,19 @@ import { describe, expect, it } from 'vitest';import { formatBillingAmount, formatBillingMinorAmount } from '../money';-const usd = (value: number) =>- new Intl.NumberFormat(undefined, { style: 'currency', currency: 'USD' }).format(value);+// USD 走窄符号(见 money.ts 的 billingCurrencyFormatOptions),否则 zh-CN 等宿主+// locale 下 Intl 默认会给出 US$,期望值必须带上同一选项才跟实现同源;这里仍不写死+// 符号,以免绑定具体 ICU 版本的分组符与小数点。+const USD_FORMAT_OPTIONS: Intl.NumberFormatOptions = {+ style: 'currency',+ currency: 'USD',+ currencyDisplay: 'narrowSymbol',+};+const usd = (value: number) => new Intl.NumberFormat(undefined, USD_FORMAT_OPTIONS).format(value);const jpy = (value: number) =>new Intl.NumberFormat(undefined, { style: 'currency', currency: 'JPY' }).format(value);const exactUsd = (whole: bigint, fraction: bigint) => {- const formatter = new Intl.NumberFormat(undefined, {- style: 'currency',- currency: 'USD',- });+ const formatter = new Intl.NumberFormat(undefined, USD_FORMAT_OPTIONS);const resolved = formatter.resolvedOptions();const localizedFraction = new Intl.NumberFormat(resolved.locale, {numberingSystem: resolved.numberingSystem,