-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added optional wrappers around various libraries
BREAKING CHANGE: Removed `useReadOnlyCachedState` and `useClassNames`
- Loading branch information
1 parent
b332250
commit ea6db18
Showing
17 changed files
with
167 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* c8 ignore start */ | ||
export * from './tests/libs/react-helmet-async'; | ||
/* c8 ignore end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* c8 ignore start */ | ||
export * from './tests/libs/react-query'; | ||
/* c8 ignore end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* c8 ignore start */ | ||
export * from './tests/libs/react-router'; | ||
/* c8 ignore end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { Helmet } from 'react-helmet-async'; | ||
import { HelmetProvider } from '../react-helmet-async'; | ||
|
||
describe('wrappers(react-router-dom)', () => { | ||
describe('wrapper(Router)', () => { | ||
it('should be a MemoryRouter', async () => { | ||
const MyComponent = await HelmetProvider(() => ( | ||
<Helmet> | ||
<title>Test</title> | ||
</Helmet> | ||
)); | ||
|
||
render(<MyComponent />); | ||
|
||
await waitFor(() => expect(document.title).toEqual('Test')); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { QueryClientProvider } from '../react-query'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
describe('wrappers(react-query)', () => { | ||
describe('wrapper(QueryClientProvider)', () => { | ||
it('should support queries', async () => { | ||
const MyComponent = await QueryClientProvider(() => { | ||
const { data } = useQuery({ | ||
queryKey: ['test'], | ||
queryFn: () => 'Test', | ||
}); | ||
|
||
return data; | ||
}); | ||
|
||
render(<MyComponent />); | ||
|
||
await expect(screen.findByText('Test')).resolves.toBeTruthy(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Route, Routes } from 'react-router-dom'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { MemoryRouter } from '../react-router'; | ||
|
||
describe('wrappers(react-router-dom)', () => { | ||
describe('wrapper(MemoryRouter)', () => { | ||
it('should be a MemoryRouter', async () => { | ||
const MyComponent = await MemoryRouter(() => ( | ||
<Routes> | ||
<Route index element={'Index'} /> | ||
</Routes> | ||
)); | ||
|
||
render(<MyComponent />); | ||
|
||
expect(screen.getByText('Index')).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { wrap } from '@rain-cafe/react-utils'; | ||
import { HelmetProvider as Provider } from 'react-helmet-async'; | ||
|
||
export const HelmetProvider = wrap(Provider); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { wrap } from '@rain-cafe/react-utils'; | ||
import { QueryClient, QueryClientProvider as Provider } from '@tanstack/react-query'; | ||
|
||
export const QueryClientProvider = wrap(Provider, () => ({ | ||
client: new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
retry: false, | ||
}, | ||
}, | ||
}), | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { wrap } from '@rain-cafe/react-utils'; | ||
import { MemoryRouter as Memory } from 'react-router-dom'; | ||
|
||
export const MemoryRouter = wrap(Memory); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters