Automerge backed Markdown editor for the Atmosphere
Something went wrong. Try again.
1234567891011121314151617181920import { Repo } from '@automerge/automerge-repo'import { afterEach, describe, expect, it, vi } from 'vitest'import { createAppRuntime } from './app-runtime'
afterEach(() => { localStorage.removeItem('reams:vault-root-url'); vi.restoreAllMocks() })
describe('runtime hidden-state teardown', () => { it('detaches opened plugin data maps when the app runtime closes', async () => { const runtime = createAppRuntime(new Repo({}), { accountUi: () => ({ onAccountClick: undefined, accountCard: null }), }) await runtime.stateData.save('plugin-data', 'demo', { enabled: true }) const url = await runtime.stateData.file('plugin-data', 'demo') const handle = (await runtime.documentManager.findFileHandle(url))! const off = vi.spyOn(handle, 'off') runtime.close() expect(off).toHaveBeenCalledWith('change', expect.any(Function)) })})