Add persistent cross-game player bank (Refs #146)

This commit is contained in:
2026-10-12 20:21:58 -04:00
parent bcd3b99ee4
commit e071e5b574
14 changed files with 866 additions and 1 deletions
+61
View File
@@ -91,6 +91,7 @@ it('shows the same ranks in the desktop profile with lifetime map scope explaine
props: {
data: {
profile,
bank: { balance: 0, available: 0, pending: false, entries: [] },
returnTo: '/leaderboard',
scope: { game: '', map: '', players: '2', metric: 'kills', entry: null }
}
@@ -135,6 +136,7 @@ it('renders a known player without qualifying history with identity and unavaila
props: {
data: {
profile,
bank: { balance: 0, available: 0, pending: false, entries: [] },
returnTo: '/leaderboard',
scope: { game: '', map: '', players: '', metric: 'highestRound', entry: null }
}
@@ -159,3 +161,62 @@ it('renders a known player without qualifying history with identity and unavaila
expect(body).not.toContain('<table');
expect(body).not.toContain('NaN');
});
it('shows the shared balance and ledger with retained and expired match references', () => {
const profile: PlayerProfile = {
guid: '101',
name: 'Cherry',
firstSeen: evidence.startedAt,
lastSeen: evidence.endedAt!,
stats,
records: map.records,
maps: [],
matches: [],
matchesTotal: 0,
limit: 25,
offset: 0
};
const entry = {
id: 1,
server: evidence.server,
amount: 2000,
balance: 2000,
createdAt: evidence.startedAt,
matchId: 71,
matchAvailable: 1
};
const body = render(PlayerProfilePage, {
props: {
data: {
profile,
bank: {
balance: 1500,
available: 1000,
pending: true,
entries: [
{
...entry,
id: 2,
amount: -500,
balance: 1500,
matchId: 72,
matchAvailable: 0
},
entry
]
},
returnTo: '/leaderboard',
scope: { game: '', map: '', metric: 'highestRound', entry: null }
}
}
}).body;
const text = body.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ');
expect(text).toContain('1,500 points');
expect(text).toContain('shared across Black Ops I and II');
expect(text).toContain('Available: 1,000 points');
expect(text).toContain('+2,000');
expect(text).toContain('-500');
expect(text).toContain('#72 (history expired)');
expect(body).toContain('href="/matches/71"');
expect(body).not.toContain('href="/matches/72"');
});