"use client"; import React from "react"; import { JsonApiConfig, JsonApiContext } from "../../client/context/JsonApiContext"; export interface MockJsonApiProviderProps { children: React.ReactNode; config?: Partial; } const defaultMockConfig: JsonApiConfig = { apiUrl: "https://api.test.com", tokenGetter: async () => "mock-token-for-testing", languageGetter: async () => "en", defaultHeaders: {}, onError: () => {}, cacheConfig: { defaultProfile: "default", }, }; /** * A test-friendly provider that wraps components with mock JSON:API context. * * @example * ```tsx * import { MockJsonApiProvider } from '@carlonicora/nextjs-jsonapi/testing'; * * render( * * * * ); * ``` * * @example With custom config * ```tsx * render( * * * * ); * ``` */ export function MockJsonApiProvider({ children, config }: MockJsonApiProviderProps) { const mergedConfig: JsonApiConfig = { ...defaultMockConfig, ...config, }; return {children}; } export { defaultMockConfig };