import { beforeAll, describe, expect, it } from 'vitest'
import { setCoreRuntime } from '@/core/runtime'
import { cleanSvg, composeCleaningPreview } from '@/editor/core/cleaning'
import { applyEdit, dependentsOf } from '@/editor/core/editOps'
import { testCoreRuntime } from '../helpers/core'
const DIRTY =
''
beforeAll(async () => {
setCoreRuntime(await testCoreRuntime())
})
function cleaned() {
const out = cleanSvg(new TextEncoder().encode(DIRTY))
if (!out.ok || out.value.stored === null || out.value.sha256 === null) {
throw new Error('not cleanable')
}
return {
cleaning: out.value,
drawing: { stored: out.value.stored, sha256: out.value.sha256 },
}
}
describe('cleanSvg', () => {
it('reports a removal and a stored form without the handler', () => {
const { cleaning } = cleaned()
expect(cleaning.outcome).toBe('cleanable')
expect(cleaning.style_removed).toBe(true)
expect(cleaning.stored).not.toContain('