Capture team chat and expose moderation match archives

This commit is contained in:
2026-10-17 20:11:49 -04:00
parent b678de2f6f
commit 870f13b150
28 changed files with 943 additions and 81 deletions
+13
View File
@@ -3,6 +3,7 @@ import { render } from 'svelte/server';
import { writable } from 'svelte/store';
import MatchPage from '../../src/routes/matches/[id]/+page.svelte';
import ChatPanel from '../../src/lib/ui/components/ChatPanel.svelte';
import EvidenceMessages from '../../src/lib/ui/components/moderation/EvidenceMessages.svelte';
import type { MatchDetail } from '../../src/lib/match-history.js';
vi.mock('$app/stores', () => ({
@@ -45,6 +46,18 @@ const match: MatchDetail = {
};
describe('historical match chat', () => {
it('identifies team chat in both archived messages and preserved evidence excerpts', () => {
const entry = match.chat[0];
if (entry.type !== 'message') throw new Error('Expected message fixture');
const history = [{ ...entry, message: { ...entry.message, channel: 'team' as const } }];
expect(render(ChatPanel, { props: { history } }).body).toContain('Team chat');
expect(render(EvidenceMessages, { props: { entries: history } }).body).toContain(
'Team chat'
);
expect(render(ChatPanel, { props: { history: match.chat } }).body).not.toContain(
'Team chat'
);
});
it('renders saved messages with their context and no live controls on the match page', () => {
const body = render(MatchPage, { props: { data: { match } } }).body;
expect(body).toContain('Match history');