diff --git a/packages/next/src/data/hooks/__tests__/useAppSettings.ts b/packages/next/src/data/hooks/__tests__/useAppSettings.ts index 04d8caf00..3adc1d4af 100644 --- a/packages/next/src/data/hooks/__tests__/useAppSettings.ts +++ b/packages/next/src/data/hooks/__tests__/useAppSettings.ts @@ -1,9 +1,16 @@ -import type { AppEntity, EndpointParams } from '@headstartwp/core'; +import { setHeadstartWPConfig, type AppEntity, type EndpointParams } from '@headstartwp/core'; import { expectTypeOf } from 'expect-type'; import { renderHook } from '@testing-library/react'; import { useAppSettings } from '../useAppSettings'; describe('useAppSettings types', () => { + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + it('allows overriding types', () => { interface MyAppEntity extends AppEntity { myCustomSetting: string; diff --git a/packages/next/src/data/hooks/__tests__/useAuthorArchive.ts b/packages/next/src/data/hooks/__tests__/useAuthorArchive.ts index e908142e4..4e4ca01a2 100644 --- a/packages/next/src/data/hooks/__tests__/useAuthorArchive.ts +++ b/packages/next/src/data/hooks/__tests__/useAuthorArchive.ts @@ -1,9 +1,16 @@ -import type { PostEntity, PostsArchiveParams } from '@headstartwp/core'; +import { setHeadstartWPConfig, type PostEntity, type PostsArchiveParams } from '@headstartwp/core'; import { renderHook } from '@testing-library/react'; import { expectTypeOf } from 'expect-type'; import { useAuthorArchive } from '../useAuthorArchive'; describe('useAuthorArchive types', () => { + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + it('allows overriding types', () => { interface Book extends PostEntity { isbn: string; diff --git a/packages/next/src/data/hooks/__tests__/usePosts.tsx b/packages/next/src/data/hooks/__tests__/usePosts.tsx index b41b9afad..ed10e3e97 100644 --- a/packages/next/src/data/hooks/__tests__/usePosts.tsx +++ b/packages/next/src/data/hooks/__tests__/usePosts.tsx @@ -1,4 +1,4 @@ -import type { PostEntity, PostsArchiveParams } from '@headstartwp/core'; +import { setHeadstartWPConfig, type PostEntity, type PostsArchiveParams } from '@headstartwp/core'; import { SettingsProvider } from '@headstartwp/core/react'; import { renderHook, waitFor } from '@testing-library/react'; import { expectTypeOf } from 'expect-type'; @@ -12,8 +12,21 @@ jest.mock('next/router', () => ({ })); describe('usePosts', () => { + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + const wrapper = ({ children }) => { - return {children}; + return ( + + {children} + + ); }; beforeAll(() => { @@ -36,6 +49,13 @@ describe('usePosts types', () => { useRouterMock.mockReturnValue({ query: { path: '' } }); }); + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + it('allows overriding types', () => { interface Book extends PostEntity { isbn: string; diff --git a/packages/next/src/data/hooks/__tests__/usePrepareFetch.tsx b/packages/next/src/data/hooks/__tests__/usePrepareFetch.tsx index 2c24fb2fb..99897b04b 100644 --- a/packages/next/src/data/hooks/__tests__/usePrepareFetch.tsx +++ b/packages/next/src/data/hooks/__tests__/usePrepareFetch.tsx @@ -1,6 +1,7 @@ import { SettingsProvider } from '@headstartwp/core/react'; import { renderHook } from '@testing-library/react'; import * as React from 'react'; +import { setHeadstartWPConfig } from '@headstartwp/core'; import { usePrepareFetch } from '../usePrepareFetch'; const useRouterMock = jest.fn(); @@ -10,11 +11,22 @@ jest.mock('next/router', () => ({ })); describe('usePrepareFetch', () => { + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + it('injects locale if locale is set and polylang integration is enabled', () => { const wrapper = ({ children }) => { return ( {children} @@ -36,7 +48,11 @@ describe('usePrepareFetch', () => { const wrapper = ({ children }) => { return ( {children} diff --git a/packages/next/src/data/hooks/__tests__/useSearch.ts b/packages/next/src/data/hooks/__tests__/useSearch.ts index 20b2dcbf4..b8004be26 100644 --- a/packages/next/src/data/hooks/__tests__/useSearch.ts +++ b/packages/next/src/data/hooks/__tests__/useSearch.ts @@ -1,9 +1,16 @@ -import type { PostEntity, PostsArchiveParams } from '@headstartwp/core'; +import { setHeadstartWPConfig, type PostEntity, type PostsArchiveParams } from '@headstartwp/core'; import { renderHook } from '@testing-library/react'; import { expectTypeOf } from 'expect-type'; import { useSearch } from '../useSearch'; describe('useSearch types', () => { + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + it('allows overriding types', () => { interface Book extends PostEntity { isbn: string; diff --git a/packages/next/src/data/hooks/__tests__/useTerms.ts b/packages/next/src/data/hooks/__tests__/useTerms.ts index 64ff81e1a..7a46816b0 100644 --- a/packages/next/src/data/hooks/__tests__/useTerms.ts +++ b/packages/next/src/data/hooks/__tests__/useTerms.ts @@ -1,9 +1,20 @@ -import type { TaxonomyArchiveParams, TermEntity } from '@headstartwp/core'; +import { + setHeadstartWPConfig, + type TaxonomyArchiveParams, + type TermEntity, +} from '@headstartwp/core'; import { renderHook } from '@testing-library/react'; import { expectTypeOf } from 'expect-type'; import { useTerms } from '../useTerms'; describe('useTerms types', () => { + beforeAll(() => { + setHeadstartWPConfig({ + sourceUrl: 'https://js1.10up.com', + useWordPressPlugin: true, + }); + }); + it('allows overriding types', () => { interface Genre extends TermEntity { editor: string;