-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.test.ts
More file actions
66 lines (57 loc) · 2.56 KB
/
Copy pathindex.test.ts
File metadata and controls
66 lines (57 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* ObjectUI
* Copyright (c) 2024-present ObjectStack Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { describe, it, expect } from 'vitest';
import { ComponentRegistry } from '@object-ui/core';
// Imports all renderers to register them. Module scope, NOT awaited inside a
// `beforeAll` — there the cold transform of the renderer graph is billed to the
// hook, against `hookTimeout`. That is what made the sibling plugin-kanban test
// blow its raised 15s budget at 15021ms under full parallel load
// (objectui#3010); this file's timed portion was already at 5.83s of the same
// 15s. The import phase has no test/hook timeout, so no raised timeout is
// needed. See AGENTS.md §9 (test discipline).
import './index';
describe('Plugin Markdown', () => {
describe('markdown component', () => {
it('should be registered in ComponentRegistry', () => {
const markdownRenderer = ComponentRegistry.get('markdown');
expect(markdownRenderer).toBeDefined();
});
it('should have proper metadata', () => {
const config = ComponentRegistry.getConfig('markdown');
expect(config).toBeDefined();
expect(config?.label).toBe('Markdown');
expect(config?.category).toBe('plugin');
expect(config?.inputs).toBeDefined();
expect(config?.defaultProps).toBeDefined();
});
it('should have expected inputs', () => {
const config = ComponentRegistry.getConfig('markdown');
const inputNames = config?.inputs?.map((input: any) => input.name) || [];
expect(inputNames).toContain('content');
expect(inputNames).toContain('className');
});
it('should have content as required input', () => {
const config = ComponentRegistry.getConfig('markdown');
const contentInput = config?.inputs?.find((input: any) => input.name === 'content');
expect(contentInput).toBeDefined();
expect(contentInput?.required).toBe(true);
expect(contentInput?.type).toBe('string');
expect(contentInput?.inputType).toBe('textarea');
});
it('should have sensible default props', () => {
const config = ComponentRegistry.getConfig('markdown');
const defaults = config?.defaultProps;
expect(defaults).toBeDefined();
expect(defaults?.content).toBeDefined();
expect(typeof defaults?.content).toBe('string');
expect(defaults?.content.length).toBeGreaterThan(0);
// Verify it contains markdown syntax
expect(defaults?.content).toContain('#');
});
});
});