@m4l/testing 0.0.16 → 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/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.16",
4
+ "version": "0.0.17",
5
5
  "license": "UNLICENSED",
6
6
  "author": "M4L Team",
7
7
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import { expect as t } from "vitest";
2
- const n = (l) => l?.type === "nested", h = (l) => l?.type === "date", k = (l) => l?.type === "boolean", d = (l) => l?.type === "setCheck", C = (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", c = (l) => l?.type === "icon", P = (l, r) => {
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 (h(e.hookCall))
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 (k(e.hookCall))
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 (d(e.hookCall))
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 (C(e.hookCall))
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 (c(e.hookCall))
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
- P as t
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>;