@m4l/testing 0.0.11 → 0.0.13
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect as t } from "vitest";
|
|
2
|
-
const
|
|
2
|
+
const n = (o) => o?.type === "nested", h = (o) => o?.type === "date", d = (o) => o?.type === "boolean", k = (o) => o?.type === "setCheck", C = (o) => o?.type === "price", p = (o) => o?.type === "points", y = (o) => o?.type === "uncertainty", f = (o) => o?.type === "concatenated", m = (o) => o?.type === "chipStatus", V = (o, a) => {
|
|
3
3
|
t(o).toHaveLength(a.length), a.forEach((e, s) => {
|
|
4
4
|
const l = o[s], u = e.hookCall?.type ?? "none";
|
|
5
5
|
describe(`Column ${s + 1}: ${e.key} (${u})`, () => {
|
|
@@ -8,16 +8,16 @@ const h = (o) => o?.type === "nested", d = (o) => o?.type === "date", n = (o) =>
|
|
|
8
8
|
}), e.hookCall) {
|
|
9
9
|
let r = !0, i = !0;
|
|
10
10
|
it("should have the correct hook call properties", () => {
|
|
11
|
-
if (
|
|
11
|
+
if (n(e.hookCall))
|
|
12
12
|
t(l.testProps).toEqual({
|
|
13
13
|
fieldValue: e.hookCall.fieldValue
|
|
14
14
|
});
|
|
15
|
-
else if (
|
|
15
|
+
else if (h(e.hookCall))
|
|
16
16
|
t(l.testProps).toEqual({
|
|
17
17
|
fieldValue: e.hookCall.fieldValue,
|
|
18
18
|
presentationType: e.hookCall.presentationType
|
|
19
19
|
});
|
|
20
|
-
else if (
|
|
20
|
+
else if (d(e.hookCall))
|
|
21
21
|
t(l.testProps).toEqual({
|
|
22
22
|
fieldValue: e.hookCall.fieldValue,
|
|
23
23
|
presentationType: e.hookCall.presentationType
|
|
@@ -51,7 +51,7 @@ const h = (o) => o?.type === "nested", d = (o) => o?.type === "date", n = (o) =>
|
|
|
51
51
|
});
|
|
52
52
|
else if (m(e.hookCall))
|
|
53
53
|
t(l.testProps).toEqual({
|
|
54
|
-
fieldLabel: e.hookCall.fieldLabel,
|
|
54
|
+
fieldLabel: typeof e.hookCall.fieldLabel == "function" ? t.any(Function) : e.hookCall.fieldLabel,
|
|
55
55
|
fieldStatus: e.hookCall.fieldStatus,
|
|
56
56
|
statusesColors: e.hookCall.statusesColors,
|
|
57
57
|
fallbackColor: e.hookCall.fallbackColor
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { it as s, expect as
|
|
2
|
-
const
|
|
1
|
+
import { it as s, expect as r, describe as c } from "vitest";
|
|
2
|
+
const f = (a, n) => {
|
|
3
3
|
s("should return an array with the correct length", () => {
|
|
4
|
-
|
|
5
|
-
}),
|
|
6
|
-
const
|
|
7
|
-
|
|
4
|
+
r(Array.isArray(a)).toBe(!0), r(a.length).toBe(n.length);
|
|
5
|
+
}), n.forEach((t, u) => {
|
|
6
|
+
const o = a[u];
|
|
7
|
+
c(`Field ${u + 1}: ${t.name}`, () => {
|
|
8
8
|
s("should have the correct basic properties", () => {
|
|
9
|
-
|
|
10
|
-
}),
|
|
11
|
-
|
|
9
|
+
r(o).toBeDefined(), r(o.name).toBe(t.name), r(o.dictionaryId).toBe(t.dictionaryId), r(o.type).toBe(t.type), r(o.multiple).toBe(t.multiple), r(o.presence).toBe(t.presence), t.defaultOperator && r(o.defaultOperator).toEqual(t.defaultOperator), t.restritcOperatorsTo && r(o.restritcOperatorsTo).toEqual(t.restritcOperatorsTo), t.defaultOperand1 && r(o.defaultOperand1).toEqual(t.defaultOperand1), t.urlIcon && r(o.urlIcon).toBe(t.urlIcon);
|
|
10
|
+
}), t.type === "selectAsync" && s("should have the correct selectAsync properties", () => {
|
|
11
|
+
r(o.selectAsyncOptions).toBeDefined(), r(o.selectAsyncOptions).toMatchObject(t.selectAsyncOptions);
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
f as t
|
|
18
18
|
};
|
package/testTools/utils.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render as m, cleanup as p } from "@testing-library/react";
|
|
2
2
|
import c from "@testing-library/user-event";
|
|
3
3
|
import { act as s } from "react";
|
|
4
4
|
import { afterEach as a } from "vitest";
|
|
5
5
|
a(() => {
|
|
6
|
-
|
|
6
|
+
p(), vi.clearAllMocks();
|
|
7
7
|
});
|
|
8
8
|
const i = (e, t = {}) => {
|
|
9
9
|
let r;
|
|
10
10
|
return s(() => {
|
|
11
|
-
r =
|
|
11
|
+
r = m(e, {
|
|
12
12
|
// wrap provider(s) here if needed
|
|
13
13
|
wrapper: ({ children: o }) => o,
|
|
14
14
|
...t
|