@react-foundry/component-test-helpers 0.1.9 → 0.2.1
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/dist/index.cjs +36 -0
- package/dist/index.js +9 -30
- package/package.json +11 -10
- package/dist/index.mjs +0 -15
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.userEvent = exports.render = void 0;
|
|
21
|
+
const react_1 = require("react");
|
|
22
|
+
const react_router_1 = require("react-router");
|
|
23
|
+
const react_2 = require("@testing-library/react");
|
|
24
|
+
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
25
|
+
require("@testing-library/jest-dom");
|
|
26
|
+
const Providers = ({ children, routerProps }) => ((0, react_1.createElement)(react_router_1.MemoryRouter, routerProps || {
|
|
27
|
+
initialEntries: ['/previous', '/current', '/next'],
|
|
28
|
+
initialIndex: 1
|
|
29
|
+
}, children));
|
|
30
|
+
const render = (ui, options) => (0, react_2.render)(ui, {
|
|
31
|
+
wrapper: Providers,
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
exports.render = render;
|
|
35
|
+
exports.userEvent = user_event_1.default.default;
|
|
36
|
+
__exportStar(require("@testing-library/react"), exports);
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.userEvent = exports.render = void 0;
|
|
21
|
-
const react_1 = require("react");
|
|
22
|
-
const react_router_1 = require("react-router");
|
|
23
|
-
const react_2 = require("@testing-library/react");
|
|
24
|
-
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
25
|
-
require("@testing-library/jest-dom");
|
|
26
|
-
const Providers = ({ children, routerProps }) => ((0, react_1.createElement)(react_router_1.MemoryRouter, routerProps || {
|
|
1
|
+
import { createElement as h } from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router';
|
|
3
|
+
import { render as _render } from '@testing-library/react';
|
|
4
|
+
import userEventDefault from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
const Providers = ({ children, routerProps }) => (h(MemoryRouter, routerProps || {
|
|
27
7
|
initialEntries: ['/previous', '/current', '/next'],
|
|
28
8
|
initialIndex: 1
|
|
29
9
|
}, children));
|
|
30
|
-
const render = (ui, options) => (
|
|
10
|
+
export const render = (ui, options) => _render(ui, {
|
|
31
11
|
wrapper: Providers,
|
|
32
12
|
...options
|
|
33
13
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
__exportStar(require("@testing-library/react"), exports);
|
|
14
|
+
export const userEvent = userEventDefault.default;
|
|
15
|
+
export * from '@testing-library/react';
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-foundry/component-test-helpers",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Helper functions for testing React components.",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"import": "./dist/index.
|
|
10
|
-
"require": "./dist/index.
|
|
11
|
-
"default": "./dist/index.
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"default": "./dist/index.js"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"author": "Daniel A.C. Martin <npm@daniel-martin.co.uk> (http://daniel-martin.co.uk/)",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"peerDependencies": {
|
|
20
|
-
"react": "^19.2.
|
|
21
|
+
"react": "^19.2.5",
|
|
21
22
|
"react-router": "^7.13.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
@@ -32,11 +33,11 @@
|
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
35
|
-
"build": "npm run build:
|
|
36
|
-
"build:
|
|
37
|
-
"build:
|
|
36
|
+
"build": "npm run build:cjs && npm run build:esm",
|
|
37
|
+
"build:cjs": "tsc -m commonjs && find dist -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.cjs\"' {} \\;",
|
|
38
|
+
"build:esm": "tsc",
|
|
38
39
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
39
40
|
},
|
|
40
|
-
"module": "dist/index.
|
|
41
|
+
"module": "dist/index.js",
|
|
41
42
|
"typings": "dist/index.d.ts"
|
|
42
43
|
}
|
package/dist/index.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createElement as h } from 'react';
|
|
2
|
-
import { MemoryRouter } from 'react-router';
|
|
3
|
-
import { render as _render } from '@testing-library/react';
|
|
4
|
-
import userEventDefault from '@testing-library/user-event';
|
|
5
|
-
import '@testing-library/jest-dom';
|
|
6
|
-
const Providers = ({ children, routerProps }) => (h(MemoryRouter, routerProps || {
|
|
7
|
-
initialEntries: ['/previous', '/current', '/next'],
|
|
8
|
-
initialIndex: 1
|
|
9
|
-
}, children));
|
|
10
|
-
export const render = (ui, options) => _render(ui, {
|
|
11
|
-
wrapper: Providers,
|
|
12
|
-
...options
|
|
13
|
-
});
|
|
14
|
-
export const userEvent = userEventDefault.default;
|
|
15
|
-
export * from '@testing-library/react';
|