Skip to content

Commit 71dc588

Browse files
committed
Add plugin integration tests and test script
Introduces a new Vitest-based test suite for plugin integration in the runner package, verifying manual registration of Kanban and Charts plugin components. Also adds a 'test' script to package.json for running the tests.
1 parent 968807a commit 71dc588

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

packages/runner/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"scripts": {
1717
"dev": "vite",
1818
"build": "vite build",
19-
"preview": "vite preview"
19+
"preview": "vite preview",
20+
"test": "vitest run"
2021
},
2122
"dependencies": {
2223
"@object-ui/components": "workspace:*",
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
import { describe, it, expect } from 'vitest';
3+
import { kanbanComponents } from '@object-ui/plugin-kanban';
4+
import { chartComponents } from '@object-ui/plugin-charts';
5+
import { ComponentRegistry } from '@object-ui/core';
6+
7+
describe('Plugin Integration Protocol', () => {
8+
describe('Kanban Plugin', () => {
9+
it('should export components object for manual registration', () => {
10+
expect(kanbanComponents).toBeDefined();
11+
expect(kanbanComponents.kanban).toBeDefined();
12+
});
13+
14+
it('should contain valid React component', () => {
15+
const Component = kanbanComponents.kanban;
16+
expect(typeof Component).toBe('function'); // React components are functions
17+
});
18+
});
19+
20+
describe('Charts Plugin', () => {
21+
it('should export component objects for manual registration', () => {
22+
expect(chartComponents).toBeDefined();
23+
expect(chartComponents['bar-chart']).toBeDefined();
24+
expect(chartComponents['chart']).toBeDefined();
25+
});
26+
27+
it('should export correctly named "bar-chart" key matching schema usage', () => {
28+
// Critical check for the bug we fixed (type mismatch)
29+
expect(Object.keys(chartComponents)).toContain('bar-chart');
30+
expect(chartComponents['bar-chart']).toBeDefined();
31+
});
32+
});
33+
34+
describe('Manual Registration Simulation', () => {
35+
it('should successfully register kanban via manual components', () => {
36+
// Clear registry to simulate clean state
37+
// Note: In a real app we wouldn't clear, but here we want to prove registration works
38+
39+
// Act: Manually register
40+
if (kanbanComponents?.kanban) {
41+
ComponentRegistry.register('test-kanban-manual', kanbanComponents.kanban);
42+
}
43+
44+
// Assert
45+
expect(ComponentRegistry.get('test-kanban-manual')).toBeDefined();
46+
});
47+
48+
it('should successfully register bar-chart via manual components', () => {
49+
if (chartComponents?.['bar-chart']) {
50+
ComponentRegistry.register('test-bar-chart-manual', chartComponents['bar-chart']);
51+
}
52+
53+
expect(ComponentRegistry.get('test-bar-chart-manual')).toBeDefined();
54+
});
55+
});
56+
});

0 commit comments

Comments
 (0)