@pega/cosmos-react-test-utils 9.0.0-build.29.20 → 9.0.0-build.29.22
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/lib/mocks/iconMock.d.ts
CHANGED
package/lib/mocks/iconMock.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
jest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {
|
|
2
|
-
// Should probably be using global require here in case
|
|
3
|
+
// Should probably be using global require here in case these icon names are themselves being mocked,
|
|
3
4
|
// but that requires including @types/node which throws off type checking for tests.
|
|
4
|
-
const {
|
|
5
|
+
const { default: iconNames } = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/iconNames');
|
|
6
|
+
const { default: streamlineIconNames } = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames');
|
|
5
7
|
const mod = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/Icon');
|
|
8
|
+
// Register all icons as empty to avoid dynamic imports in tests.
|
|
9
|
+
mod.registerIcon(...iconNames.map(name => ({ set: 'budicon', name, Component: () => null })), ...streamlineIconNames.map(name => ({ set: 'streamline', name, Component: () => null })));
|
|
6
10
|
return {
|
|
7
11
|
__esModule: true,
|
|
8
|
-
...mod
|
|
9
|
-
default: forwardRef(function IconMock({ name, ...restProps }, ref) {
|
|
10
|
-
return createElement(mod.StyledIcon, {
|
|
11
|
-
role: 'presentation',
|
|
12
|
-
...restProps,
|
|
13
|
-
'data-icon-name': name,
|
|
14
|
-
ref
|
|
15
|
-
});
|
|
16
|
-
})
|
|
12
|
+
...mod
|
|
17
13
|
};
|
|
18
14
|
});
|
|
19
|
-
export {};
|
|
20
15
|
//# sourceMappingURL=iconMock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IACjE,qGAAqG;IACrG,oFAAoF;IACpF,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,aAAa,CAE/C,uDAAuD,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC,aAAa,CAEzD,iEAAiE,CAAC,CAAC;IAErE,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAC5B,kDAAkD,CACnD,CAAC;IAEF,iEAAiE;IACjE,GAAG,CAAC,YAAY,CACd,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAC3E,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CACzF,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;KACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {\n // Should probably be using global require here in case these icon names are themselves being mocked,\n // but that requires including @types/node which throws off type checking for tests.\n const { default: iconNames } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Icon/iconNames')\n >('@pega/cosmos-react-core/lib/components/Icon/iconNames');\n const { default: streamlineIconNames } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames')\n >('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames');\n\n const mod = jest.requireActual<typeof import('@pega/cosmos-react-core/lib/components/Icon/Icon')>(\n '@pega/cosmos-react-core/lib/components/Icon/Icon'\n );\n\n // Register all icons as empty to avoid dynamic imports in tests.\n mod.registerIcon(\n ...iconNames.map(name => ({ set: 'budicon', name, Component: () => null })),\n ...streamlineIconNames.map(name => ({ set: 'streamline', name, Component: () => null }))\n );\n\n return {\n __esModule: true,\n ...mod\n };\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-test-utils",
|
|
3
|
-
"version": "9.0.0-build.29.
|
|
3
|
+
"version": "9.0.0-build.29.22",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build": "tsc -b tsconfig.build.json"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@pega/cosmos-react-core": "9.0.0-build.29.
|
|
20
|
+
"@pega/cosmos-react-core": "9.0.0-build.29.22",
|
|
21
21
|
"@testing-library/dom": "^10.3.0",
|
|
22
22
|
"@testing-library/react": "^16.0.0",
|
|
23
23
|
"@testing-library/user-event": "^14.6.1",
|