import { beforeAll, describe, expect, it } from 'vitest';
beforeAll(async () => {
await import('./chat-format.js');
});
describe('chat formatting', () => {
it('escapes executable HTML before applying limited Markdown', () => {
const result = globalThis.KoalaSyncChatFormat.formatChatText('
**bold** *italic*');
expect(result).toBe('<img src=x onerror=alert(1)> bold italic');
expect(result).not.toContain('
{
expect(globalThis.KoalaSyncChatFormat.tokenizeChatText(' **bold** *italic*')).toEqual([
{ type: 'text', text: ' ' },
{ type: 'strong', text: 'bold' },
{ type: 'text', text: ' ' },
{ type: 'em', text: 'italic' }
]);
});
});