@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,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/testing",
3
3
  "description": "Shared testing utilities for MFs",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "license": "UNLICENSED",
6
6
  "author": "M4L Team",
7
7
  "lint-staged": {
@@ -1,5 +1,5 @@
1
1
  import { expect as t } from "vitest";
2
- const h = (o) => o?.type === "nested", d = (o) => o?.type === "date", n = (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) => {
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 (h(e.hookCall))
11
+ if (n(e.hookCall))
12
12
  t(l.testProps).toEqual({
13
13
  fieldValue: e.hookCall.fieldValue
14
14
  });
15
- else if (d(e.hookCall))
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 (n(e.hookCall))
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 t, describe as a } from "vitest";
2
- const y = (n, e) => {
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
- t(Array.isArray(n)).toBe(!0), t(n.length).toBe(e.length);
5
- }), e.forEach((o, c) => {
6
- const r = n[c];
7
- a(`Field ${c + 1}: ${o.name}`, () => {
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
- t(r).toBeDefined(), t(r.name).toBe(o.name), t(r.dictionaryId).toBe(o.dictionaryId), t(r.type).toBe(o.type), t(r.multiple).toBe(o.multiple), t(r.presence).toBe(o.presence), o.urlIcon && t(r.urlIcon).toBe(o.urlIcon);
10
- }), o.type === "selectAsync" && s("should have the correct selectAsync properties", () => {
11
- t(r.selectAsyncOptions).toBeDefined(), t(r.selectAsyncOptions).toMatchObject(o.selectAsyncOptions);
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
- y as t
17
+ f as t
18
18
  };
@@ -1,14 +1,14 @@
1
- import { cleanup as m, render as p } from "@testing-library/react";
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
- m(), vi.clearAllMocks();
6
+ p(), vi.clearAllMocks();
7
7
  });
8
8
  const i = (e, t = {}) => {
9
9
  let r;
10
10
  return s(() => {
11
- r = p(e, {
11
+ r = m(e, {
12
12
  // wrap provider(s) here if needed
13
13
  wrapper: ({ children: o }) => o,
14
14
  ...t