import { describe, it, expect, vi } from 'vitest';
// Mock @plurimath/plurimath to avoid loading the 2.7MB Opal runtime in tests
vi.mock('@plurimath/plurimath', () => ({
default: class MockPlurimath {
constructor(private data: string, private format: string) {}
toMathml() {
if (this.data === 'ERROR') throw new Error('parse error');
return ``;
}
toAsciimath() { return this.data; }
toLatex() { return this.data; }
toHtml() { return this.data; }
toOmml() { return this.data; }
toDisplay() { return this.data; }
},
}));
import { loadPlurimath, renderToMathML, mathToHtml } from '../utils/plurimath';
describe('loadPlurimath', () => {
it('loads and returns the Plurimath class', async () => {
const Plurimath = await loadPlurimath();
expect(Plurimath).toBeDefined();
const p = new Plurimath('x', 'asciimath');
expect(p.toMathml()).toContain('