Merge remote-tracking branch 'origin/master' into feat/game-agent-canvas-resource-workbench-v2
This commit is contained in:
@@ -131,4 +131,45 @@ test('builds wallet ledger presentation with stable source fallbacks', () => {
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
for (const reason of [
|
||||
'生成美术素材',
|
||||
'编辑美术素材',
|
||||
'提取美术素材',
|
||||
'生成角色动画',
|
||||
'生成视频素材',
|
||||
'生成音效素材',
|
||||
'生成背景音乐',
|
||||
]) {
|
||||
expect(
|
||||
buildWalletLedgerPresentation(
|
||||
{
|
||||
entries: [
|
||||
buildLedgerEntry({
|
||||
amountDelta: -12,
|
||||
sourceType: 'asset_operation_consume',
|
||||
reason,
|
||||
}),
|
||||
],
|
||||
},
|
||||
12,
|
||||
).entries[0]?.sourceLabel,
|
||||
`unexpected source label for ${reason}`,
|
||||
).toBe(reason);
|
||||
}
|
||||
|
||||
expect(
|
||||
buildWalletLedgerPresentation(
|
||||
{
|
||||
entries: [
|
||||
buildLedgerEntry({
|
||||
amountDelta: -12,
|
||||
sourceType: 'asset_operation_consume',
|
||||
reason: ' ',
|
||||
}),
|
||||
],
|
||||
},
|
||||
12,
|
||||
).entries[0]?.sourceLabel,
|
||||
).toBe('资产操作消耗');
|
||||
});
|
||||
|
||||
@@ -103,7 +103,8 @@ export function buildWalletLedgerPresentation(
|
||||
createdAtLabel: formatWalletLedgerDate(entry.createdAt),
|
||||
id: entry.id,
|
||||
isIncome: entry.amountDelta > 0,
|
||||
sourceLabel: getWalletLedgerSourceLabel(entry.sourceType),
|
||||
sourceLabel:
|
||||
entry.reason?.trim() || getWalletLedgerSourceLabel(entry.sourceType),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ export type ProfileWalletLedgerEntry = {
|
||||
| 'puzzle_author_incentive_claim'
|
||||
| 'daily_task_reward';
|
||||
createdAt: string;
|
||||
reason?: string;
|
||||
};
|
||||
|
||||
export type ProfileWalletLedgerResponse = {
|
||||
|
||||
Reference in New Issue
Block a user