@m4l/testing 0.0.15 → 0.0.17
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/e2e/commands/components/DataGrid/types.d.ts +9 -1
- package/e2e/cypress.d.js +1 -0
- package/e2e/cypress.d.ts +2 -1
- package/index.d.ts +1 -0
- package/package.json +34 -45
- package/testComponents/DataGrid/helpers.js +11 -7
- package/testComponents/DataGrid/types.d.ts +6 -3
- package/e2e/commands/components/DataGrid/export.d.ts +0 -7
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { M4LGetCypressDataGridColumnsConfig } from './export';
|
|
2
1
|
declare global {
|
|
2
|
+
export type M4LDataGridCypressColumn = {
|
|
3
|
+
|
|
4
|
+
key: string;
|
|
5
|
+
value: any;
|
|
6
|
+
headerText: string;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type M4LGetCypressDataGridColumnsConfig<T> = (data: T) => M4LDataGridCypressColumn[];
|
|
10
|
+
|
|
3
11
|
namespace Cypress {
|
|
4
12
|
interface Chainable {
|
|
5
13
|
/**
|
package/e2e/cypress.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/e2e/cypress.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
/// <reference path="./commands/components/Tab/types.d.ts" />
|
|
9
9
|
/// <reference path="./commands/intercepts/noPrivileges/types.d.ts" />
|
|
10
10
|
|
|
11
|
-
export type { M4LGetCypressDataGridColumnsConfig , M4LDataGridCypressColumn } from './commands/components/DataGrid/export';
|
|
12
11
|
|
|
13
12
|
declare global {
|
|
14
13
|
namespace Cypress {
|
|
@@ -18,3 +17,5 @@ declare global {
|
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
}
|
|
20
|
+
|
|
21
|
+
export {};
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/testing",
|
|
3
3
|
"description": "Shared testing utilities for MFs",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "M4L Team",
|
|
7
7
|
"scripts": {
|
|
@@ -29,89 +29,78 @@
|
|
|
29
29
|
"*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@storybook/addon-designs": "^8.0.
|
|
33
|
-
"@storybook/addon-essentials": "
|
|
34
|
-
"@storybook/addon-interactions": "
|
|
35
|
-
"@storybook/addon-links": "
|
|
32
|
+
"@storybook/addon-designs": "^8.0.0",
|
|
33
|
+
"@storybook/addon-essentials": "8.3.4",
|
|
34
|
+
"@storybook/addon-interactions": "8.3.4",
|
|
35
|
+
"@storybook/addon-links": "8.3.4",
|
|
36
36
|
"@storybook/addon-onboarding": "^8.3.4",
|
|
37
37
|
"@storybook/blocks": "^8.3.4",
|
|
38
|
-
"@storybook/react": "
|
|
39
|
-
"@storybook/react-vite": "
|
|
40
|
-
"@storybook/test": "
|
|
38
|
+
"@storybook/react": "8.3.4",
|
|
39
|
+
"@storybook/react-vite": "8.3.4",
|
|
40
|
+
"@storybook/test": "8.3.4",
|
|
41
41
|
"@testing-library/dom": "^10.4.0",
|
|
42
42
|
"@testing-library/jest-dom": "^6.5.0",
|
|
43
43
|
"@testing-library/react": "^16.0.0",
|
|
44
44
|
"@testing-library/react-hooks": "^8.0.1",
|
|
45
45
|
"@testing-library/user-event": "^14.5.2",
|
|
46
|
-
"@types/cypress": "^1.1.6",
|
|
47
46
|
"@types/jest": "^29.5.10",
|
|
48
47
|
"@vitejs/plugin-react": "^4.0.0",
|
|
49
48
|
"@vitest/coverage-istanbul": "^3.1.1",
|
|
50
49
|
"@vitest/coverage-v8": "^3.1.1",
|
|
51
50
|
"@vitest/ui": "^3.1.1",
|
|
52
51
|
"cypress": "^14.1.0",
|
|
53
|
-
"cypress-vite": "
|
|
52
|
+
"cypress-vite": "1.6.0",
|
|
54
53
|
"happy-dom": "^17.1.9",
|
|
55
|
-
"jest-environment-jsdom": "
|
|
54
|
+
"jest-environment-jsdom": "29.7.0",
|
|
56
55
|
"jsdom": "^25.0.1",
|
|
57
56
|
"storybook": "^8.3.4"
|
|
58
57
|
},
|
|
59
58
|
"peerDependencies": {
|
|
60
|
-
"@types/react": "
|
|
61
|
-
"react": "
|
|
62
|
-
"vitest": "
|
|
59
|
+
"@types/react": "18.3.23",
|
|
60
|
+
"react": "18.3.1",
|
|
61
|
+
"vitest": "3.1.1"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@m4l/components": "^9.0.0",
|
|
66
65
|
"@m4l/config": "^1.1.2",
|
|
67
66
|
"@m4l/vite-plugins": "^1.1.5",
|
|
68
67
|
"@types/node": "^22.7.3",
|
|
69
|
-
"@types/react": "
|
|
70
|
-
"@types/react-dom": "
|
|
71
|
-
"eslint": "
|
|
72
|
-
"lefthook": "
|
|
73
|
-
"lint-staged": "
|
|
74
|
-
"react": "
|
|
75
|
-
"react-dom": "
|
|
76
|
-
"typescript": "
|
|
77
|
-
"vite": "
|
|
68
|
+
"@types/react": "18.3.23",
|
|
69
|
+
"@types/react-dom": "18.3.7",
|
|
70
|
+
"eslint": "9.28.0",
|
|
71
|
+
"lefthook": "1.11.13",
|
|
72
|
+
"lint-staged": "15.5.2",
|
|
73
|
+
"react": "18.3.1",
|
|
74
|
+
"react-dom": "18.3.1",
|
|
75
|
+
"typescript": "5.8.3",
|
|
76
|
+
"vite": "6.3.5",
|
|
78
77
|
"vite-plugin-dts": "^4.2.1",
|
|
79
|
-
"vitest": "
|
|
78
|
+
"vitest": "3.1.1"
|
|
80
79
|
},
|
|
81
80
|
"resolutions": {
|
|
82
81
|
"glob": "^10.4.5",
|
|
83
|
-
"react": "
|
|
84
|
-
"@types/react": "
|
|
85
|
-
"@types/react-dom": "
|
|
86
|
-
"react-dom": "
|
|
82
|
+
"react": "18.3.1",
|
|
83
|
+
"@types/react": "18.3.23",
|
|
84
|
+
"@types/react-dom": "18.3.7",
|
|
85
|
+
"react-dom": "18.3.1",
|
|
87
86
|
"@vitejs/plugin-react": "^4.0.0"
|
|
88
87
|
},
|
|
89
88
|
"overrides": {
|
|
90
89
|
"glob": "^10.4.5",
|
|
91
|
-
"eslint": "
|
|
92
|
-
"react": "
|
|
93
|
-
"@types/react": "
|
|
94
|
-
"@types/react-dom": "
|
|
95
|
-
"react-dom": "
|
|
90
|
+
"eslint": "9.28.0",
|
|
91
|
+
"react": "18.3.1",
|
|
92
|
+
"@types/react": "18.3.23",
|
|
93
|
+
"@types/react-dom": "18.3.7",
|
|
94
|
+
"react-dom": "18.3.1"
|
|
96
95
|
},
|
|
97
96
|
"files": [
|
|
98
97
|
"*"
|
|
99
98
|
],
|
|
99
|
+
"type": "module",
|
|
100
100
|
"source": "./index.js",
|
|
101
|
-
"main": "
|
|
101
|
+
"main": "./index.js",
|
|
102
102
|
"module": "./index.js",
|
|
103
|
-
"type": "module",
|
|
104
103
|
"types": "./index.d.ts",
|
|
105
|
-
"exports": {
|
|
106
|
-
".": {
|
|
107
|
-
"types": "./index.d.ts",
|
|
108
|
-
"import": "./index.js",
|
|
109
|
-
"require": null
|
|
110
|
-
},
|
|
111
|
-
"./cypress": {
|
|
112
|
-
"types": "./e2e/cypress.d.ts"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
104
|
"sideEffects": false,
|
|
116
105
|
"publishConfig": {
|
|
117
106
|
"access": "public"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect as t } from "vitest";
|
|
2
|
-
const n = (l) => l?.type === "nested",
|
|
2
|
+
const n = (l) => l?.type === "nested", k = (l) => l?.type === "date", h = (l) => l?.type === "boolean", C = (l) => l?.type === "setCheck", d = (l) => l?.type === "price", p = (l) => l?.type === "points", y = (l) => l?.type === "uncertainty", f = (l) => l?.type === "concatenated", m = (l) => l?.type === "chipStatus", V = (l) => l?.type === "tags", P = (l) => l?.type === "icon", c = (l) => l?.type === "color", E = (l, r) => {
|
|
3
3
|
t(l).toHaveLength(r.length), r.forEach((e, i) => {
|
|
4
4
|
const o = l[i], u = e.hookCall?.type ?? "none";
|
|
5
5
|
describe(`Column ${i + 1}: ${e.key} (${u})`, () => {
|
|
@@ -12,24 +12,24 @@ const n = (l) => l?.type === "nested", h = (l) => l?.type === "date", k = (l) =>
|
|
|
12
12
|
t(o.testProps).toEqual({
|
|
13
13
|
fieldValue: e.hookCall.fieldValue
|
|
14
14
|
});
|
|
15
|
-
else if (
|
|
15
|
+
else if (k(e.hookCall))
|
|
16
16
|
t(o.testProps).toEqual({
|
|
17
17
|
fieldValue: e.hookCall.fieldValue,
|
|
18
18
|
presentationType: e.hookCall.presentationType
|
|
19
19
|
});
|
|
20
|
-
else if (
|
|
20
|
+
else if (h(e.hookCall))
|
|
21
21
|
t(o.testProps).toEqual({
|
|
22
22
|
fieldValue: e.hookCall.fieldValue,
|
|
23
23
|
presentationType: e.hookCall.presentationType
|
|
24
24
|
});
|
|
25
|
-
else if (
|
|
25
|
+
else if (C(e.hookCall))
|
|
26
26
|
t(o.testProps).toEqual({
|
|
27
27
|
field: e.hookCall.field,
|
|
28
28
|
disabledGetter: t.any(Function),
|
|
29
29
|
rowKeyGetter: t.any(Function),
|
|
30
30
|
useHook: t.any(Function)
|
|
31
31
|
}), a = !1, s = !1;
|
|
32
|
-
else if (
|
|
32
|
+
else if (d(e.hookCall))
|
|
33
33
|
t(o.testProps).toEqual({
|
|
34
34
|
fieldValue: e.hookCall.fieldValue
|
|
35
35
|
});
|
|
@@ -60,10 +60,14 @@ const n = (l) => l?.type === "nested", h = (l) => l?.type === "date", k = (l) =>
|
|
|
60
60
|
t(o.testProps).toEqual({
|
|
61
61
|
fieldValue: e.hookCall.fieldValue
|
|
62
62
|
});
|
|
63
|
-
else if (
|
|
63
|
+
else if (P(e.hookCall))
|
|
64
64
|
t(o.testProps).toEqual({
|
|
65
65
|
getIconProps: t.any(Function)
|
|
66
66
|
}), a = !1, s = !1;
|
|
67
|
+
else if (c(e.hookCall))
|
|
68
|
+
t(o.testProps).toEqual({
|
|
69
|
+
fieldValue: e.hookCall.fieldValue
|
|
70
|
+
}), a = !1, s = !1;
|
|
67
71
|
else
|
|
68
72
|
throw new Error(`Unknown hook call type: ${e.hookCall?.type}`);
|
|
69
73
|
}), it("should have formatter, customFilter and customSort functions", () => {
|
|
@@ -77,5 +81,5 @@ const n = (l) => l?.type === "nested", h = (l) => l?.type === "date", k = (l) =>
|
|
|
77
81
|
});
|
|
78
82
|
};
|
|
79
83
|
export {
|
|
80
|
-
|
|
84
|
+
E as t
|
|
81
85
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps, ColumnTagsFormatterProps, ColumnIconFormatterProps } from '@m4l/components';
|
|
1
|
+
import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps, ColumnTagsFormatterProps, ColumnIconFormatterProps, ColumnColorFormatterProps } from '@m4l/components';
|
|
2
2
|
type BaseColumnConfig<T> = Column<T, unknown>;
|
|
3
3
|
type BaseHookCall = {
|
|
4
|
-
type: 'nested' | 'date' | 'boolean' | 'price' | 'points' | 'interactiveCheck' | 'setCheck' | 'uncertainty' | 'concatenated' | 'chipStatus' | 'tags' | 'icon';
|
|
4
|
+
type: 'nested' | 'date' | 'boolean' | 'price' | 'points' | 'interactiveCheck' | 'setCheck' | 'uncertainty' | 'concatenated' | 'chipStatus' | 'tags' | 'icon' | 'color';
|
|
5
5
|
};
|
|
6
6
|
export type TestingNestedValueHookCall<T> = BaseHookCall & ColumnNestedValueFormatterProps<T> & {
|
|
7
7
|
type: 'nested';
|
|
@@ -39,8 +39,11 @@ export type TestingTagsHookCall<T> = BaseHookCall & ColumnTagsFormatterProps<T>
|
|
|
39
39
|
export type TestingIconHookCall<T> = BaseHookCall & ColumnIconFormatterProps<T> & {
|
|
40
40
|
type: 'icon';
|
|
41
41
|
};
|
|
42
|
+
export type TestingColorHookCall<T> = BaseHookCall & ColumnColorFormatterProps<T> & {
|
|
43
|
+
type: 'color';
|
|
44
|
+
};
|
|
42
45
|
export type TestingColumnConfig<T> = BaseColumnConfig<T> & {
|
|
43
|
-
hookCall?: TestingNestedValueHookCall<T> | TestingDateHookCall<T> | TestingBooleanHookCall<T> | TestingPriceHookCall<T> | TestingPointsHookCall<T> | TestingInteractiveCheckHookCall<T> | TestingSetCheckHookCall<T> | TestingUncertaintyHookCall<T> | TestingConcatenatedHookCall<T> | TestingChipStatusHookCall<T> | TestingTagsHookCall<T> | TestingIconHookCall<T>;
|
|
46
|
+
hookCall?: TestingNestedValueHookCall<T> | TestingDateHookCall<T> | TestingBooleanHookCall<T> | TestingPriceHookCall<T> | TestingPointsHookCall<T> | TestingInteractiveCheckHookCall<T> | TestingSetCheckHookCall<T> | TestingUncertaintyHookCall<T> | TestingConcatenatedHookCall<T> | TestingChipStatusHookCall<T> | TestingTagsHookCall<T> | TestingIconHookCall<T> | TestingColorHookCall<T>;
|
|
44
47
|
};
|
|
45
48
|
export type TestingColumn = Column<unknown, unknown> & {
|
|
46
49
|
testProps?: Record<string, unknown>;
|