1- import React from 'react ' ;
1+ import { describe , it , expect , vi } from 'vitest ' ;
22import { render , screen } from '@testing-library/react' ;
3- import { describe , it , expect , vi , beforeAll } from 'vitest ' ;
4- import { ComponentRegistry } from '@object-ui/core ' ;
3+ import React from 'react ' ;
4+ import { ObjectCalendarRenderer } from './index ' ;
55
66// Mock dependencies
77vi . mock ( '@object-ui/react' , ( ) => ( {
@@ -18,25 +18,8 @@ vi.mock('./ObjectCalendar', () => ({
1818} ) ) ;
1919
2020describe ( 'Plugin Calendar Registration' , ( ) => {
21- beforeAll ( async ( ) => {
22- // Import index to trigger registration
23- await import ( './index' ) ;
24- } ) ;
25-
26- it ( 'registers object-calendar component' , ( ) => {
27- const config = ComponentRegistry . get ( 'object-calendar' ) ;
28- expect ( config ) . toBeDefined ( ) ;
29- // Label might be 'Object Calendar' - checking existence mostly
30- } ) ;
31-
32- it ( 'registered component passes dataSource from context' , ( ) => {
33- const config = ComponentRegistry . get ( 'object-calendar' ) ;
34- const Renderer = config ?. component as React . FC < any > ;
35-
36- expect ( Renderer ) . toBeDefined ( ) ;
37-
38- render ( < Renderer schema = { { } } /> ) ;
39-
21+ it ( 'renderer passes dataSource from context' , ( ) => {
22+ render ( < ObjectCalendarRenderer schema = { { type : 'object-calendar' } } /> ) ;
4023 expect ( screen . getByTestId ( 'calendar-mock' ) ) . toHaveTextContent ( 'DataSource: mock-datasource' ) ;
4124 } ) ;
4225} ) ;
0 commit comments