@launchdarkly/jest 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.13](https://github.com/launchdarkly/js-core/compare/jest-v0.1.12...jest-v0.1.13) (2025-11-21)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @launchdarkly/react-native-client-sdk bumped from ~10.12.0 to ~10.12.1
11
+
3
12
  ## [0.1.12](https://github.com/launchdarkly/js-core/compare/jest-v0.1.11...jest-v0.1.12) (2025-11-03)
4
13
 
5
14
 
package/README.md CHANGED
@@ -28,9 +28,6 @@ Then in `jest.config.js` add `@launchdarkly/jest/{framework}` to setupFiles:
28
28
  ```js
29
29
  // jest.config.js
30
30
  module.exports = {
31
- // for react
32
- setupFiles: ['@launchdarkly/jest/react'],
33
-
34
31
  // for react-native
35
32
  setupFiles: ['@launchdarkly/jest/react-native'],
36
33
  };
@@ -38,7 +35,32 @@ module.exports = {
38
35
 
39
36
  ## Quickstart
40
37
 
41
- TODO:
38
+ // Welcome.test.tsx
39
+ import React from 'react';
40
+ import { render } from '@testing-library/react-native';
41
+ import {
42
+ mockFlags,
43
+ resetLDMocks,
44
+ getLDClient,
45
+ } from '@launchdarkly/js-core/tooling/jest';
46
+ import Welcome from './Welcome';
47
+
48
+ afterEach(() => {
49
+ resetLDMocks();
50
+ });
51
+
52
+ test('evaluates a boolean flag', () => {
53
+ mockFlags({ 'my-boolean-flag': true });
54
+ const { getByText } = render(<Welcome />);
55
+ expect(getByText('Flag value is true')).toBeTruthy();
56
+ });
57
+
58
+ test('captures a track call', () => {
59
+ const client = getLDClient(); // mocked client from LD jest tooling
60
+ client.track('event-name', { foo: 'bar' });
61
+ expect(client.track).toHaveBeenCalledWith('event-name', { foo: 'bar' });
62
+ expect(client.track).toHaveBeenCalledTimes(1);
63
+ });
42
64
 
43
65
  ## Developing this package
44
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@launchdarkly/jest",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Easily unit test LaunchDarkly feature flagged components with jest",
5
5
  "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/tooling/jest",
6
6
  "repository": {
@@ -62,7 +62,7 @@
62
62
  "typescript": "5.1.6"
63
63
  },
64
64
  "dependencies": {
65
- "@launchdarkly/react-native-client-sdk": "~10.12.0",
65
+ "@launchdarkly/react-native-client-sdk": "~10.12.1",
66
66
  "@testing-library/react-hooks": "^8.0.1",
67
67
  "@testing-library/react-native": "^12.7.2",
68
68
  "@types/lodash": "^4.17.7",