e0a5f57793
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import { beforeEach, describe, expect, it } from 'vitest'
|
|
import { clearGlobalCustomComponents, getCustomNodeComponents, removeCustomComponents, setCustomComponents } from '../src/utils/nodeComponents'
|
|
|
|
describe('nodeComponents scoped API', () => {
|
|
beforeEach(() => {
|
|
// clear any global state by removing known ids
|
|
try {
|
|
removeCustomComponents('test-scope')
|
|
// clear global via clearGlobalCustomComponents when needed
|
|
}
|
|
catch {
|
|
// ignore
|
|
}
|
|
})
|
|
|
|
it('sets and retrieves a scoped mapping', () => {
|
|
setCustomComponents('test-scope', { custom_node: 'MyComp' })
|
|
const mapping = getCustomNodeComponents('test-scope')
|
|
expect(mapping.custom_node).toBe('MyComp')
|
|
})
|
|
|
|
it('sets and retrieves a global mapping (legacy)', () => {
|
|
setCustomComponents({ code_block: 'MarkdownCodeBlock' })
|
|
const mapping = getCustomNodeComponents()
|
|
expect(mapping.code_block).toBe('MarkdownCodeBlock')
|
|
})
|
|
|
|
it('removes a scoped mapping', () => {
|
|
setCustomComponents('test-scope', { foo: 'bar' })
|
|
expect(getCustomNodeComponents('test-scope').foo).toBe('bar')
|
|
removeCustomComponents('test-scope')
|
|
expect(getCustomNodeComponents('test-scope').foo).toBeUndefined()
|
|
})
|
|
|
|
it('clears global mapping and disallows removing global via removeCustomComponents', () => {
|
|
setCustomComponents({ code_block: 'MarkdownCodeBlock' })
|
|
expect(getCustomNodeComponents().code_block).toBe('MarkdownCodeBlock')
|
|
// clear global mapping
|
|
clearGlobalCustomComponents()
|
|
expect(getCustomNodeComponents().code_block).toBeUndefined()
|
|
// attempting to remove global via removeCustomComponents should throw
|
|
expect(() => removeCustomComponents('__global__')).toThrow()
|
|
})
|
|
})
|