Skip to content

Commit ca1fdbb

Browse files
authored
build: Correct imports for jest-dom. (#309)
1 parent 53c926e commit ca1fdbb

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@rollup/plugin-node-resolve": "^15.1.0",
5252
"@rollup/plugin-terser": "^0.4.3",
5353
"@rollup/plugin-typescript": "^11.1.2",
54+
"@testing-library/dom": "^10.4.0",
5455
"@testing-library/jest-dom": "^6.4.8",
5556
"@testing-library/react": "^16.0.0",
5657
"@types/eslint__js": "^8.42.3",

src/asyncWithLDProvider.test.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
import React from 'react';
2+
import '@testing-library/dom';
3+
import '@testing-library/jest-dom';
4+
import { render } from '@testing-library/react';
5+
import { initialize, LDContext, LDFlagChangeset, LDOptions } from 'launchdarkly-js-client-sdk';
6+
import { AsyncProviderConfig, LDReactOptions } from './types';
7+
import { Consumer } from './context';
8+
import asyncWithLDProvider from './asyncWithLDProvider';
9+
import wrapperOptions from './wrapperOptions';
10+
import { fetchFlags } from './utils';
11+
12+
113
jest.mock('launchdarkly-js-client-sdk', () => {
214
const actual = jest.requireActual('launchdarkly-js-client-sdk');
315

@@ -15,15 +27,6 @@ jest.mock('./utils', () => {
1527
};
1628
});
1729

18-
import React from 'react';
19-
import { render } from '@testing-library/react';
20-
import { initialize, LDContext, LDFlagChangeset, LDOptions } from 'launchdarkly-js-client-sdk';
21-
import { AsyncProviderConfig, LDReactOptions } from './types';
22-
import { Consumer } from './context';
23-
import asyncWithLDProvider from './asyncWithLDProvider';
24-
import wrapperOptions from './wrapperOptions';
25-
import { fetchFlags } from './utils';
26-
2730
const clientSideID = 'test-client-side-id';
2831
const context: LDContext = { key: 'yus', kind: 'user', name: 'yus ng' };
2932
const rawFlags = { 'test-flag': true, 'another-test-flag': true };

src/asyncWithLDProvider.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import getFlagsProxy from './getFlagsProxy';
77
import wrapperOptions from './wrapperOptions';
88
import ProviderState from './providerState';
99

10-
// Extend the expect with additional methods.
11-
import '@testing-library/jest-dom';
12-
1310
/**
1411
* This is an async function which initializes LaunchDarkly's JS SDK (`launchdarkly-js-client-sdk`)
1512
* and awaits it so all flags and the ldClient are ready before the consumer app is rendered.

0 commit comments

Comments
 (0)