|
| 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