@m4l/testing 1.1.0 → 1.2.0
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/README.md
CHANGED
|
@@ -314,6 +314,9 @@ Current shared Vitest helpers in `@m4l/testing/vitest` include:
|
|
|
314
314
|
- `createM4lPackageGclickModuleMock(...)`
|
|
315
315
|
- `createM4lPackageGclickRealtimeModuleMock(...)`
|
|
316
316
|
- `createM4lAppGraphicsModuleMock(...)`
|
|
317
|
+
Includes a neutral `useInfinitePaginate()` entry (no rows, `hasMore: false`,
|
|
318
|
+
`rowsPerPage: 25`, inert `infiniteScrollOptions`) so cursor list modules
|
|
319
|
+
override it with `vi.mocked(useInfinitePaginate)`.
|
|
317
320
|
- `createM4lAppLayoutsModuleMock(...)`
|
|
318
321
|
- `createM4lPackageComponentsModuleMock(...)`
|
|
319
322
|
- `createM4lPackageCoreModuleMock(...)`
|
|
@@ -102,10 +102,10 @@ function he(e) {
|
|
|
102
102
|
function Se(e) {
|
|
103
103
|
return e?.type === "icon";
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Pe(e) {
|
|
106
106
|
return e?.type === "color";
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Me(e) {
|
|
109
109
|
return e?.type === "image";
|
|
110
110
|
}
|
|
111
111
|
function k(e) {
|
|
@@ -116,7 +116,7 @@ function k(e) {
|
|
|
116
116
|
sorted: !0
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function A(e, n, o, r, a) {
|
|
120
120
|
e.push(
|
|
121
121
|
`${n} ${o}: expected ${k(r)}, got ${k(a)}`
|
|
122
122
|
);
|
|
@@ -129,7 +129,7 @@ function w(e, n, o) {
|
|
|
129
129
|
`${n} ${o}: expected undefined, got ${k("function")}`
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Ae(e, n, o, r) {
|
|
133
133
|
if (!o) {
|
|
134
134
|
e.push(`${n} testProps: expected an object, got undefined`);
|
|
135
135
|
return;
|
|
@@ -140,7 +140,7 @@ function be(e, n, o, r) {
|
|
|
140
140
|
), i.forEach((s) => {
|
|
141
141
|
const c = r[s], d = o[s];
|
|
142
142
|
if (c === D) {
|
|
143
|
-
typeof d != "function" &&
|
|
143
|
+
typeof d != "function" && A(
|
|
144
144
|
e,
|
|
145
145
|
n,
|
|
146
146
|
`testProps.${s}`,
|
|
@@ -149,7 +149,7 @@ function be(e, n, o, r) {
|
|
|
149
149
|
);
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
g(d, c) ||
|
|
152
|
+
g(d, c) || A(
|
|
153
153
|
e,
|
|
154
154
|
n,
|
|
155
155
|
`testProps.${s}`,
|
|
@@ -158,7 +158,7 @@ function be(e, n, o, r) {
|
|
|
158
158
|
);
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function be(e) {
|
|
162
162
|
return se(e) ? {
|
|
163
163
|
expectedTestProps: {
|
|
164
164
|
fieldValue: e.fieldValue,
|
|
@@ -264,14 +264,14 @@ function Me(e) {
|
|
|
264
264
|
requiresFormatter: !0,
|
|
265
265
|
requiresFilter: !1,
|
|
266
266
|
requiresSort: !1
|
|
267
|
-
} :
|
|
267
|
+
} : Pe(e) ? {
|
|
268
268
|
expectedTestProps: {
|
|
269
269
|
fieldValue: e.fieldValue
|
|
270
270
|
},
|
|
271
271
|
requiresFormatter: !0,
|
|
272
272
|
requiresFilter: !1,
|
|
273
273
|
requiresSort: !1
|
|
274
|
-
} :
|
|
274
|
+
} : Me(e) ? {
|
|
275
275
|
expectedTestProps: {
|
|
276
276
|
fieldValue: e.fieldValue,
|
|
277
277
|
fieldText: e.fieldText,
|
|
@@ -304,33 +304,33 @@ function et(e, n) {
|
|
|
304
304
|
o.push(`${s} missing column at index ${a}`);
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
|
-
if (i.key !== r.key &&
|
|
307
|
+
if (i.key !== r.key && A(o, s, "key", r.key, i.key), i.name !== r.name && A(o, s, "name", r.name, i.name), i.type !== r.type && A(o, s, "type", r.type, i.type), g(i.align, r.align) || A(
|
|
308
308
|
o,
|
|
309
309
|
s,
|
|
310
310
|
"align",
|
|
311
311
|
r.align,
|
|
312
312
|
i.align
|
|
313
|
-
), g(i.width, r.width) ||
|
|
313
|
+
), g(i.width, r.width) || A(
|
|
314
314
|
o,
|
|
315
315
|
s,
|
|
316
316
|
"width",
|
|
317
317
|
r.width,
|
|
318
318
|
i.width
|
|
319
|
-
), g(i.visible, r.visible) ||
|
|
319
|
+
), g(i.visible, r.visible) || A(
|
|
320
320
|
o,
|
|
321
321
|
s,
|
|
322
322
|
"visible",
|
|
323
323
|
r.visible,
|
|
324
324
|
i.visible
|
|
325
|
-
), r.fixed !== void 0 && !g(i.fixed, r.fixed) &&
|
|
325
|
+
), r.fixed !== void 0 && !g(i.fixed, r.fixed) && A(
|
|
326
326
|
o,
|
|
327
327
|
s,
|
|
328
328
|
"fixed",
|
|
329
329
|
r.fixed,
|
|
330
330
|
i.fixed
|
|
331
331
|
), r.hookCall) {
|
|
332
|
-
const c =
|
|
333
|
-
c.expectedTestProps &&
|
|
332
|
+
const c = be(r.hookCall);
|
|
333
|
+
c.expectedTestProps && Ae(
|
|
334
334
|
o,
|
|
335
335
|
s,
|
|
336
336
|
i.testProps,
|
|
@@ -498,7 +498,7 @@ function R(e) {
|
|
|
498
498
|
sorted: !0
|
|
499
499
|
});
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function M(e, n, o, r, a) {
|
|
502
502
|
e.push(
|
|
503
503
|
`${n} ${o}: expected ${R(r)}, got ${R(a)}`
|
|
504
504
|
);
|
|
@@ -513,37 +513,37 @@ function rt(e, n) {
|
|
|
513
513
|
o.push(`${s} missing field at index ${a}`);
|
|
514
514
|
return;
|
|
515
515
|
}
|
|
516
|
-
if (i.name !== r.name &&
|
|
516
|
+
if (i.name !== r.name && M(
|
|
517
517
|
o,
|
|
518
518
|
s,
|
|
519
519
|
"name",
|
|
520
520
|
r.name,
|
|
521
521
|
i.name
|
|
522
|
-
), g(i.dictionaryId, r.dictionaryId) ||
|
|
522
|
+
), g(i.dictionaryId, r.dictionaryId) || M(
|
|
523
523
|
o,
|
|
524
524
|
s,
|
|
525
525
|
"dictionaryId",
|
|
526
526
|
r.dictionaryId,
|
|
527
527
|
i.dictionaryId
|
|
528
|
-
), i.type !== r.type &&
|
|
528
|
+
), i.type !== r.type && M(
|
|
529
529
|
o,
|
|
530
530
|
s,
|
|
531
531
|
"type",
|
|
532
532
|
r.type,
|
|
533
533
|
i.type
|
|
534
|
-
), g(i.multiple, r.multiple) ||
|
|
534
|
+
), g(i.multiple, r.multiple) || M(
|
|
535
535
|
o,
|
|
536
536
|
s,
|
|
537
537
|
"multiple",
|
|
538
538
|
r.multiple,
|
|
539
539
|
i.multiple
|
|
540
|
-
), g(i.presence, r.presence) ||
|
|
540
|
+
), g(i.presence, r.presence) || M(
|
|
541
541
|
o,
|
|
542
542
|
s,
|
|
543
543
|
"presence",
|
|
544
544
|
r.presence,
|
|
545
545
|
i.presence
|
|
546
|
-
), r.defaultOperator !== void 0 && !g(i.defaultOperator, r.defaultOperator) &&
|
|
546
|
+
), r.defaultOperator !== void 0 && !g(i.defaultOperator, r.defaultOperator) && M(
|
|
547
547
|
o,
|
|
548
548
|
s,
|
|
549
549
|
"defaultOperator",
|
|
@@ -552,19 +552,19 @@ function rt(e, n) {
|
|
|
552
552
|
), r.restritcOperatorsTo !== void 0 && !g(
|
|
553
553
|
i.restritcOperatorsTo,
|
|
554
554
|
r.restritcOperatorsTo
|
|
555
|
-
) &&
|
|
555
|
+
) && M(
|
|
556
556
|
o,
|
|
557
557
|
s,
|
|
558
558
|
"restritcOperatorsTo",
|
|
559
559
|
r.restritcOperatorsTo,
|
|
560
560
|
i.restritcOperatorsTo
|
|
561
|
-
), r.defaultOperand1 !== void 0 && !g(i.defaultOperand1, r.defaultOperand1) &&
|
|
561
|
+
), r.defaultOperand1 !== void 0 && !g(i.defaultOperand1, r.defaultOperand1) && M(
|
|
562
562
|
o,
|
|
563
563
|
s,
|
|
564
564
|
"defaultOperand1",
|
|
565
565
|
r.defaultOperand1,
|
|
566
566
|
i.defaultOperand1
|
|
567
|
-
), r.urlIcon !== void 0 && !g(i.urlIcon, r.urlIcon) &&
|
|
567
|
+
), r.urlIcon !== void 0 && !g(i.urlIcon, r.urlIcon) && M(
|
|
568
568
|
o,
|
|
569
569
|
s,
|
|
570
570
|
"urlIcon",
|
|
@@ -580,7 +580,7 @@ function rt(e, n) {
|
|
|
580
580
|
r.selectAsyncOptions && !g(
|
|
581
581
|
i.selectAsyncOptions,
|
|
582
582
|
r.selectAsyncOptions
|
|
583
|
-
) &&
|
|
583
|
+
) && M(
|
|
584
584
|
o,
|
|
585
585
|
s,
|
|
586
586
|
"selectAsyncOptions",
|
|
@@ -813,9 +813,9 @@ function W({
|
|
|
813
813
|
getTypographyStyles: t.fn(() => ({})),
|
|
814
814
|
getComponentClasses: t.fn(
|
|
815
815
|
(c, d) => (Array.isArray(d) ? d : Object.keys(d)).reduce(
|
|
816
|
-
(m,
|
|
816
|
+
(m, P) => ({
|
|
817
817
|
...m,
|
|
818
|
-
[
|
|
818
|
+
[P]: P
|
|
819
819
|
}),
|
|
820
820
|
{}
|
|
821
821
|
)
|
|
@@ -884,10 +884,10 @@ function W({
|
|
|
884
884
|
DataGrid: t.fn(({ children: c }) => /* @__PURE__ */ u("div", { "data-testid": "data-grid", children: c })),
|
|
885
885
|
Stack: v("stack"),
|
|
886
886
|
Button: t.fn(
|
|
887
|
-
({ children: c, disabled: d, label: l, onClick: m, "data-testid":
|
|
887
|
+
({ children: c, disabled: d, label: l, onClick: m, "data-testid": P }) => /* @__PURE__ */ u(
|
|
888
888
|
"button",
|
|
889
889
|
{
|
|
890
|
-
"data-testid": typeof
|
|
890
|
+
"data-testid": typeof P == "string" ? P : "button",
|
|
891
891
|
disabled: !!d,
|
|
892
892
|
onClick: m,
|
|
893
893
|
children: String(l ?? c ?? "")
|
|
@@ -1124,9 +1124,9 @@ function ft({
|
|
|
1124
1124
|
const m = x({
|
|
1125
1125
|
...U,
|
|
1126
1126
|
...o
|
|
1127
|
-
}),
|
|
1127
|
+
}), P = r ?? B(), h = ee(
|
|
1128
1128
|
s
|
|
1129
|
-
),
|
|
1129
|
+
), b = te(s), K = n ?? {}, z = l ?? {
|
|
1130
1130
|
flagsActions: {
|
|
1131
1131
|
addFlag: t.fn()
|
|
1132
1132
|
}
|
|
@@ -1155,7 +1155,7 @@ function ft({
|
|
|
1155
1155
|
NetworkProvider: p("network-provider"),
|
|
1156
1156
|
UserPreferencesProvider: p("user-preferences-provider"),
|
|
1157
1157
|
useBaseStore: t.fn(
|
|
1158
|
-
(f) => f(
|
|
1158
|
+
(f) => f(K)
|
|
1159
1159
|
),
|
|
1160
1160
|
useAuth: t.fn(() => Y),
|
|
1161
1161
|
DomainCountryProvider: p("domain-country-provider"),
|
|
@@ -1193,9 +1193,9 @@ function ft({
|
|
|
1193
1193
|
})),
|
|
1194
1194
|
useFlagsPresent: t.fn().mockReturnValue(!0),
|
|
1195
1195
|
useFlagsStore: t.fn(
|
|
1196
|
-
(f) => f(
|
|
1196
|
+
(f) => f(z)
|
|
1197
1197
|
),
|
|
1198
|
-
useHostTools: t.fn(() =>
|
|
1198
|
+
useHostTools: t.fn(() => P),
|
|
1199
1199
|
useModuleDictionary: t.fn(() => ({
|
|
1200
1200
|
getLabel: t.fn(i),
|
|
1201
1201
|
getModuleLabel: t.fn(() => a)
|
|
@@ -1220,18 +1220,18 @@ function ft({
|
|
|
1220
1220
|
currencyDecimalDigits: typeof f?.currencyDecimalDigits == "number" ? f.currencyDecimalDigits : h.currencyDecimalDigits
|
|
1221
1221
|
})),
|
|
1222
1222
|
useUserPreferences: t.fn(() => ({
|
|
1223
|
-
...
|
|
1223
|
+
...b,
|
|
1224
1224
|
changeUserPreferences: t.fn(
|
|
1225
|
-
|
|
1225
|
+
b.changeUserPreferences
|
|
1226
1226
|
),
|
|
1227
1227
|
convertMagnitude: t.fn(
|
|
1228
|
-
|
|
1228
|
+
b.convertMagnitude
|
|
1229
1229
|
),
|
|
1230
1230
|
formatNumber: t.fn(
|
|
1231
|
-
|
|
1231
|
+
b.formatNumber
|
|
1232
1232
|
),
|
|
1233
1233
|
getMagnitudeProperty: t.fn(
|
|
1234
|
-
|
|
1234
|
+
b.getMagnitudeProperty
|
|
1235
1235
|
)
|
|
1236
1236
|
})),
|
|
1237
1237
|
voidFunction: t.fn(),
|
|
@@ -1257,6 +1257,25 @@ function lt({
|
|
|
1257
1257
|
onRowsPerPageChange: t.fn(),
|
|
1258
1258
|
Refresh: t.fn()
|
|
1259
1259
|
})),
|
|
1260
|
+
useInfinitePaginate: t.fn(() => ({
|
|
1261
|
+
rows: [],
|
|
1262
|
+
setRows: t.fn(),
|
|
1263
|
+
totalRecords: 0,
|
|
1264
|
+
loading: !1,
|
|
1265
|
+
Refresh: t.fn(),
|
|
1266
|
+
clearRows: t.fn(),
|
|
1267
|
+
rowsPerPage: 25,
|
|
1268
|
+
infiniteScrollOptions: {
|
|
1269
|
+
hasMore: !1,
|
|
1270
|
+
isLoadingMore: !1,
|
|
1271
|
+
loadMoreError: !1,
|
|
1272
|
+
onLoadMore: t.fn(),
|
|
1273
|
+
resetKey: 0,
|
|
1274
|
+
totalRecords: 0,
|
|
1275
|
+
rowsPerPage: 25,
|
|
1276
|
+
onRowsPerPageChange: t.fn()
|
|
1277
|
+
}
|
|
1278
|
+
})),
|
|
1260
1279
|
useRows: t.fn(() => ({
|
|
1261
1280
|
rows: [],
|
|
1262
1281
|
refresh: t.fn()
|
|
@@ -1387,7 +1406,7 @@ function gt({
|
|
|
1387
1406
|
popupsActions: {
|
|
1388
1407
|
addPopup: t.fn()
|
|
1389
1408
|
}
|
|
1390
|
-
},
|
|
1409
|
+
}, P = s ?? {
|
|
1391
1410
|
getCookie: t.fn(),
|
|
1392
1411
|
getWindowId: t.fn(() => "test-window-id"),
|
|
1393
1412
|
setCookie: t.fn(),
|
|
@@ -1405,7 +1424,7 @@ function gt({
|
|
|
1405
1424
|
),
|
|
1406
1425
|
useWatchTyped: t.fn(() => {
|
|
1407
1426
|
}),
|
|
1408
|
-
useWindowToolsMF: t.fn(() =>
|
|
1427
|
+
useWindowToolsMF: t.fn(() => P),
|
|
1409
1428
|
...a
|
|
1410
1429
|
};
|
|
1411
1430
|
}
|
|
@@ -1424,13 +1443,13 @@ function vt({
|
|
|
1424
1443
|
...n
|
|
1425
1444
|
}), l = r ?? B(), m = s ?? {
|
|
1426
1445
|
hasPrivilege: t.fn(() => !0)
|
|
1427
|
-
},
|
|
1446
|
+
}, P = c ?? {
|
|
1428
1447
|
networkOperation: t.fn()
|
|
1429
1448
|
};
|
|
1430
1449
|
return {
|
|
1431
1450
|
...e,
|
|
1432
1451
|
useLocalStorageWithListener: t.fn(
|
|
1433
|
-
(h,
|
|
1452
|
+
(h, b) => [b, t.fn()]
|
|
1434
1453
|
),
|
|
1435
1454
|
useEnvironment: t.fn(() => d),
|
|
1436
1455
|
useHostTools: t.fn(() => l),
|
|
@@ -1440,7 +1459,7 @@ function vt({
|
|
|
1440
1459
|
})),
|
|
1441
1460
|
useModulePrivileges: t.fn(() => m),
|
|
1442
1461
|
useModuleSkeleton: t.fn(() => !1),
|
|
1443
|
-
useNetwork: t.fn(() =>
|
|
1462
|
+
useNetwork: t.fn(() => P),
|
|
1444
1463
|
...a
|
|
1445
1464
|
};
|
|
1446
1465
|
}
|
|
@@ -1603,7 +1622,7 @@ function St({
|
|
|
1603
1622
|
...n
|
|
1604
1623
|
};
|
|
1605
1624
|
}
|
|
1606
|
-
function
|
|
1625
|
+
function Pt({
|
|
1607
1626
|
baseModule: e = {},
|
|
1608
1627
|
moduleOverrides: n = {}
|
|
1609
1628
|
} = {}) {
|
|
@@ -1629,7 +1648,7 @@ function At({
|
|
|
1629
1648
|
...n
|
|
1630
1649
|
};
|
|
1631
1650
|
}
|
|
1632
|
-
function
|
|
1651
|
+
function Mt({
|
|
1633
1652
|
baseModule: e = {},
|
|
1634
1653
|
moduleOverrides: n = {}
|
|
1635
1654
|
} = {}) {
|
|
@@ -1665,7 +1684,7 @@ function Pt({
|
|
|
1665
1684
|
...n
|
|
1666
1685
|
};
|
|
1667
1686
|
}
|
|
1668
|
-
function
|
|
1687
|
+
function At({
|
|
1669
1688
|
baseModule: e = {},
|
|
1670
1689
|
moduleOverrides: n = {},
|
|
1671
1690
|
useFormContextData: o = {}
|
|
@@ -1688,7 +1707,7 @@ function bt({
|
|
|
1688
1707
|
...n
|
|
1689
1708
|
};
|
|
1690
1709
|
}
|
|
1691
|
-
function
|
|
1710
|
+
function bt() {
|
|
1692
1711
|
return {
|
|
1693
1712
|
Resizable: t.fn(({ children: e }) => /* @__PURE__ */ u("div", { "data-testid": "resizable", children: e }))
|
|
1694
1713
|
};
|
|
@@ -1812,10 +1831,10 @@ export {
|
|
|
1812
1831
|
vt as S,
|
|
1813
1832
|
ht as T,
|
|
1814
1833
|
St as U,
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1834
|
+
Pt as V,
|
|
1835
|
+
Mt as W,
|
|
1836
|
+
At as X,
|
|
1837
|
+
bt as Y,
|
|
1819
1838
|
Tt as Z,
|
|
1820
1839
|
oe as a,
|
|
1821
1840
|
ie as b,
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { afterAll as r, afterEach as c, beforeAll as s, beforeEach as M, describ
|
|
|
3
3
|
import { cleanup as u, fireEvent as m, renderHook as C, screen as f, waitFor as g, within as A } from "@testing-library/react";
|
|
4
4
|
import { default as E } from "@testing-library/user-event";
|
|
5
5
|
import { c as S } from "./chunks/render-CsuV8xqo.js";
|
|
6
|
-
import { D as x, a as L, M as R, f as D, v as _, y as G, s as h, k as b, h as B, u as H, z as I, p as O, l as T, o as w, P as y, G as N, H as W, J as K, I as U, N as V, K as z, L as Y, O as Z, Q as j, R as q, S as J, T as Q, U as X, V as $, W as ee, m as ae, q as oe, j as te, n as re, Y as ce, X as se, Z as Me, i as le, t as ne, r as ie, d as ke, b as pe, c as de, e as ue, g as me, B as Ce, A as fe, C as ge, w as Ae, E as Fe, F as Ee, x as Pe } from "./chunks/reactLeaflet-
|
|
6
|
+
import { D as x, a as L, M as R, f as D, v as _, y as G, s as h, k as b, h as B, u as H, z as I, p as O, l as T, o as w, P as y, G as N, H as W, J as K, I as U, N as V, K as z, L as Y, O as Z, Q as j, R as q, S as J, T as Q, U as X, V as $, W as ee, m as ae, q as oe, j as te, n as re, Y as ce, X as se, Z as Me, i as le, t as ne, r as ie, d as ke, b as pe, c as de, e as ue, g as me, B as Ce, A as fe, C as ge, w as Ae, E as Fe, F as Ee, x as Pe } from "./chunks/reactLeaflet-Ca5S8G_T.js";
|
|
7
7
|
export {
|
|
8
8
|
x as DEFAULT_RHF_SUBMIT_REF_GLOBAL_KEY,
|
|
9
9
|
L as M4L_APP_DATAGRID_SEMANTIC_WIDTHS,
|