File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -28,17 +28,31 @@ Then in `jest.config.js` add `@launchdarkly/jest/{framework}` to setupFiles:
2828``` js
2929// jest.config.js
3030module .exports = {
31- // for react
32- setupFiles: [' @launchdarkly/jest/react' ],
33-
3431 // for react-native
3532 setupFiles: [' @launchdarkly/jest/react-native' ],
3633};
3734```
3835
3936## Quickstart
4037
41- TODO:
38+ describe('Welcome component test', () => {
39+ afterEach(() => {
40+ resetLDMocks();
41+ });
42+
43+ test('mock boolean flag correctly', () => {
44+ mockFlags({ 'my-boolean-flag': true });
45+ render(<Welcome />);
46+ expect(screen.getByText('Flag value is true')).toBeTruthy();
47+ });
48+
49+ test('mock ldClient correctly', () => {
50+ const current = useLDClient();
51+
52+ current?.track('event');
53+ expect(current.track).toHaveBeenCalledTimes(1);
54+ });
55+ });
4256
4357## Developing this package
4458
You can’t perform that action at this time.
0 commit comments