Skip to content

Commit 0f2094e

Browse files
authored
fix: re-render w/ useWhenProviderReady, add tests (#901)
This PR: - brings react-sdk test coverage from 0% to ~95% - adds DOM-based testing (tests based on asserting DOM entity states) - tests for query-style, basic, and detailed evaluation APIs - tests for suspense functionality and re-rendering on context change - tests for some util functions and hooks - `renderHook` tests for non suspending hooks - fixes a bug where `useWhenProviderReady` didn't cause re-render after the provider is ready if suspense wasn't used (leading to an out-of-date return value for provider readiness) ![image](https://github.com/open-feature/js-sdk/assets/25272906/e8ee420f-0167-4048-94e3-53176bd883b9) --------- Signed-off-by: Todd Baert <[email protected]>
1 parent 240a461 commit 0f2094e

File tree

8 files changed

+1095
-9
lines changed

8 files changed

+1095
-9
lines changed

jest.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,24 @@ export default {
171171
],
172172
},
173173
},
174+
{
175+
displayName: 'react',
176+
testEnvironment: 'jsdom',
177+
preset: 'ts-jest',
178+
testMatch: ['<rootDir>/packages/react/test/**/*.spec.ts*'],
179+
moduleNameMapper: {
180+
'@openfeature/core': '<rootDir>/packages/shared/src',
181+
'@openfeature/web-sdk': '<rootDir>/packages/client/src',
182+
},
183+
transform: {
184+
'^.+\\.tsx$': [
185+
'ts-jest',
186+
{
187+
tsconfig: '<rootDir>/packages/react/test/tsconfig.json',
188+
},
189+
],
190+
},
191+
},
174192
],
175193

176194
// Use this configuration option to add custom reporters to Jest

0 commit comments

Comments
 (0)