This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { render } from 'svelte/server';
|
||||
import AfkReserveCard from '../../src/lib/ui/components/AfkReserveCard.svelte';
|
||||
import type { afkProfile } from '../../src/lib/server/fleet/afk.js';
|
||||
|
||||
it('separates active play, confirmed usage and corrected crash charges without linking expired matches', () => {
|
||||
const account: ReturnType<typeof afkProfile> = {
|
||||
freeSeconds: 1200,
|
||||
savedSeconds: 600,
|
||||
availableSeconds: 1800,
|
||||
reservedSeconds: 180,
|
||||
capacitySeconds: 21600,
|
||||
freeRenewsAt: '2026-10-18T12:00:00Z',
|
||||
activeSeconds: 3600,
|
||||
confirmedAfkSeconds: 30,
|
||||
unresolvedSessions: 1,
|
||||
expiredSessions: 2,
|
||||
purchaseCount: 1,
|
||||
purchasedSeconds: 600,
|
||||
manualReturns: 3,
|
||||
entries: [
|
||||
{
|
||||
id: 1,
|
||||
server: 't5_zombie_theater_1',
|
||||
kind: 'purchase',
|
||||
freeDelta: 0,
|
||||
savedDelta: 600,
|
||||
freeSeconds: 1200,
|
||||
savedSeconds: 600,
|
||||
sessionId: null,
|
||||
operationId: 'purchase-1',
|
||||
eventAt: '2026-10-17T12:00:00Z',
|
||||
createdAt: '2026-10-17T12:00:00Z',
|
||||
matchId: 77,
|
||||
matchAvailable: 0
|
||||
}
|
||||
],
|
||||
sessions: [
|
||||
{
|
||||
sessionId: 'crash',
|
||||
server: 't5_zombie_theater_1',
|
||||
state: 'corrected',
|
||||
authorizedSeconds: 1800,
|
||||
consumedSeconds: null,
|
||||
chargedSeconds: 45,
|
||||
confirmedSeconds: 40,
|
||||
endReason: 'crash',
|
||||
startedAt: '2026-10-17T12:00:00Z',
|
||||
endedAt: '2026-10-17T12:00:45Z'
|
||||
}
|
||||
]
|
||||
};
|
||||
const { body } = render(AfkReserveCard, { props: { account } });
|
||||
expect(body).toContain('Recorded active play');
|
||||
expect(body).toContain('Confirmed AFK time');
|
||||
expect(body).toContain('Unconfirmed');
|
||||
expect(body).toContain('Corrected charge: 45s');
|
||||
expect(body).toMatch(/excluded\s+from confirmed AFK usage/);
|
||||
expect(body).toContain('purchase-1');
|
||||
expect(body).toContain('history expired');
|
||||
expect(body).not.toContain('href="/matches/77"');
|
||||
});
|
||||
Reference in New Issue
Block a user