| 1 | import React from "react"; |
| 2 | import { vi } from "vitest"; |
| 3 | import { ServiceContainer } from "../../services/ServiceContainer.js"; |
| 4 | |
| 5 | // Create a mock service container |
| 6 | const mockServiceContainer = { |
| 7 | getSync: vi.fn((serviceName: string) => ({ |
| 8 | state: "ready", |
| 9 | value: {}, |
| 10 | error: null, |
| 11 | })), |
| 12 | isReady: vi.fn(() => true), |
| 13 | on: vi.fn(), |
| 14 | off: vi.fn(), |
| 15 | load: vi.fn(() => Promise.resolve()), |
| 16 | reload: vi.fn(() => Promise.resolve()), |
| 17 | emit: vi.fn(), |
| 18 | setMaxListeners: vi.fn(), |
| 19 | } as unknown as ServiceContainer; |
| 20 | |
| 21 | export const ServiceContainerProvider = ({ |
| 22 | children, |
| 23 | }: { |
| 24 | children: React.ReactNode; |
| 25 | }) => { |
| 26 | return React.createElement(React.Fragment, null, children); |
| 27 | }; |
| 28 | |
| 29 | export const useServiceContainer = vi.fn(() => mockServiceContainer); |