From b5760c07508a470d868658bfebbdb49a81ee648d Mon Sep 17 00:00:00 2001 From: Menelik Zafir Date: Wed, 18 Jun 2025 14:04:11 -0400 Subject: [PATCH] docs: update jest README with testing examples and removed react setup instructions that are not currently available. --- packages/tooling/jest/README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/tooling/jest/README.md b/packages/tooling/jest/README.md index 1c00c17402..fd798a06bb 100644 --- a/packages/tooling/jest/README.md +++ b/packages/tooling/jest/README.md @@ -28,9 +28,6 @@ Then in `jest.config.js` add `@launchdarkly/jest/{framework}` to setupFiles: ```js // jest.config.js module.exports = { - // for react - setupFiles: ['@launchdarkly/jest/react'], - // for react-native setupFiles: ['@launchdarkly/jest/react-native'], }; @@ -38,7 +35,24 @@ module.exports = { ## Quickstart -TODO: +describe('Welcome component test', () => { + afterEach(() => { + resetLDMocks(); + }); + + test('mock boolean flag correctly', () => { + mockFlags({ 'my-boolean-flag': true }); + render(); + expect(screen.getByText('Flag value is true')).toBeTruthy(); + }); + + test('mock ldClient correctly', () => { + const current = useLDClient(); + + current?.track('event'); + expect(current.track).toHaveBeenCalledTimes(1); + }); +}); ## Developing this package