1- import React from 'react' ;
2- import { render , screen } from '@testing-library/react' ;
3- import { describe , it , expect , vi , beforeAll } from 'vitest' ;
1+ import { describe , it , expect , beforeAll } from 'vitest' ;
42import { ComponentRegistry } from '@object-ui/core' ;
53
64describe ( 'Plugin Detail Registration' , ( ) => {
@@ -9,27 +7,12 @@ describe('Plugin Detail Registration', () => {
97 } ) ;
108
119 it ( 'registers detail-view component' , ( ) => {
12- const config = ComponentRegistry . get ( 'detail-view' ) ;
13- console . log ( 'DetailView Config Type:' , typeof config ) ;
14- console . log ( 'DetailView Config Keys:' , config ? Object . keys ( config ) : 'null' ) ;
15- console . log ( 'DetailView Config Component:' , ( config as any ) ?. component ) ;
10+ // We must use getConfig to retrieve the metadata (label, category, etc.)
11+ // .get() only returns the React Component.
12+ const config = ComponentRegistry . getConfig ( 'detail-view' ) ;
1613
17- // If config IS the component (e.g. legacy mode?), we might need to handle it.
18- // But Registry.ts says it returns config object.
19-
20- // For now, let's see what we got.
21- if ( ( config as any ) ?. label ) {
22- expect ( ( config as any ) . label ) . toBe ( 'Detail View' ) ;
23- } else {
24- // Fail with info
25- console . error ( 'Config missing label:' , config ) ;
26- // expect(true).toBe(false); // verification step
27- }
28- } ) ;
29-
30- it ( 'registers related sub-components' , ( ) => {
31- // Assuming these might be registered in future or implicitly available
32- // If index.tsx exports them, they are available to import.
33- // If they are not registered in Registry, we don't test registry for them.
14+ expect ( config ) . toBeDefined ( ) ;
15+ expect ( config ?. label ) . toBe ( 'Detail View' ) ;
16+ expect ( config ?. category ) . toBe ( 'Views' ) ;
3417 } ) ;
3518} ) ;
0 commit comments