@m4l/testing 0.0.17 → 0.0.18

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.17",
4
+ "version": "0.0.18",
5
5
  "license": "UNLICENSED",
6
6
  "author": "M4L Team",
7
7
  "scripts": {
@@ -1,85 +1,93 @@
1
- import { expect as t } from "vitest";
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
- t(l).toHaveLength(r.length), r.forEach((e, i) => {
4
- const o = l[i], u = e.hookCall?.type ?? "none";
1
+ import { expect as l } from "vitest";
2
+ const h = (t) => t?.type === "nested", k = (t) => t?.type === "date", C = (t) => t?.type === "boolean", d = (t) => t?.type === "setCheck", n = (t) => t?.type === "price", p = (t) => t?.type === "points", y = (t) => t?.type === "uncertainty", f = (t) => t?.type === "concatenated", m = (t) => t?.type === "chipStatus", V = (t) => t?.type === "tags", I = (t) => t?.type === "icon", P = (t) => t?.type === "color", E = (t) => t?.type === "image", B = (t, r) => {
3
+ l(t).toHaveLength(r.length), r.forEach((e, i) => {
4
+ const o = t[i], u = e.hookCall?.type ?? "none";
5
5
  describe(`Column ${i + 1}: ${e.key} (${u})`, () => {
6
6
  if (it("should have the correct basic properties", () => {
7
- t(o.key).toBe(e.key), t(o.name).toBe(e.name), t(o.type).toBe(e.type), t(o.align).toBe(e.align), t(o.width).toBe(e.width), t(o.visible).toBe(e.visible), e.fixed && t(o.fixed).toBe(e.fixed);
7
+ l(o.key).toBe(e.key), l(o.name).toBe(e.name), l(o.type).toBe(e.type), l(o.align).toBe(e.align), l(o.width).toBe(e.width), l(o.visible).toBe(e.visible), e.fixed && l(o.fixed).toBe(e.fixed);
8
8
  }), e.hookCall) {
9
9
  let a = !0, s = !0;
10
10
  it("should have the correct hook call properties", () => {
11
- if (n(e.hookCall))
12
- t(o.testProps).toEqual({
11
+ if (h(e.hookCall))
12
+ l(o.testProps).toEqual({
13
13
  fieldValue: e.hookCall.fieldValue
14
14
  });
15
15
  else if (k(e.hookCall))
16
- t(o.testProps).toEqual({
16
+ l(o.testProps).toEqual({
17
17
  fieldValue: e.hookCall.fieldValue,
18
18
  presentationType: e.hookCall.presentationType
19
19
  });
20
- else if (h(e.hookCall))
21
- t(o.testProps).toEqual({
20
+ else if (C(e.hookCall))
21
+ l(o.testProps).toEqual({
22
22
  fieldValue: e.hookCall.fieldValue,
23
23
  presentationType: e.hookCall.presentationType
24
24
  });
25
- else if (C(e.hookCall))
26
- t(o.testProps).toEqual({
25
+ else if (d(e.hookCall))
26
+ l(o.testProps).toEqual({
27
27
  field: e.hookCall.field,
28
- disabledGetter: t.any(Function),
29
- rowKeyGetter: t.any(Function),
30
- useHook: t.any(Function)
28
+ disabledGetter: l.any(Function),
29
+ rowKeyGetter: l.any(Function),
30
+ useHook: l.any(Function)
31
31
  }), a = !1, s = !1;
32
- else if (d(e.hookCall))
33
- t(o.testProps).toEqual({
32
+ else if (n(e.hookCall))
33
+ l(o.testProps).toEqual({
34
34
  fieldValue: e.hookCall.fieldValue
35
35
  });
36
36
  else if (p(e.hookCall))
37
- t(o.testProps).toEqual({
37
+ l(o.testProps).toEqual({
38
38
  fieldValue: e.hookCall.fieldValue,
39
39
  fieldUnit: e.hookCall.fieldUnit
40
40
  });
41
41
  else if (y(e.hookCall))
42
- t(o.testProps).toEqual({
42
+ l(o.testProps).toEqual({
43
43
  fieldValue: e.hookCall.fieldValue,
44
44
  fieldUnit: e.hookCall.fieldUnit,
45
45
  fieldSymbol: e.hookCall.fieldSymbol
46
46
  });
47
47
  else if (f(e.hookCall))
48
- t(o.testProps).toEqual({
48
+ l(o.testProps).toEqual({
49
49
  fieldValue: e.hookCall.fieldValue,
50
50
  fieldSeparator: e.hookCall.fieldSeparator
51
51
  });
52
52
  else if (m(e.hookCall))
53
- t(o.testProps).toEqual({
54
- fieldLabel: typeof e.hookCall.fieldLabel == "function" ? t.any(Function) : e.hookCall.fieldLabel,
53
+ l(o.testProps).toEqual({
54
+ fieldLabel: typeof e.hookCall.fieldLabel == "function" ? l.any(Function) : e.hookCall.fieldLabel,
55
55
  fieldStatus: e.hookCall.fieldStatus,
56
56
  statusesColors: e.hookCall.statusesColors,
57
57
  fallbackColor: e.hookCall.fallbackColor
58
58
  });
59
59
  else if (V(e.hookCall))
60
- t(o.testProps).toEqual({
60
+ l(o.testProps).toEqual({
61
61
  fieldValue: e.hookCall.fieldValue
62
62
  });
63
- else if (P(e.hookCall))
64
- t(o.testProps).toEqual({
65
- getIconProps: t.any(Function)
63
+ else if (I(e.hookCall))
64
+ l(o.testProps).toEqual({
65
+ getIconProps: l.any(Function)
66
66
  }), a = !1, s = !1;
67
- else if (c(e.hookCall))
68
- t(o.testProps).toEqual({
67
+ else if (P(e.hookCall))
68
+ l(o.testProps).toEqual({
69
69
  fieldValue: e.hookCall.fieldValue
70
70
  }), a = !1, s = !1;
71
+ else if (E(e.hookCall))
72
+ l(o.testProps).toEqual({
73
+ fieldValue: e.hookCall.fieldValue,
74
+ fieldText: e.hookCall.fieldText,
75
+ cover: e.hookCall.cover,
76
+ width: e.hookCall.width,
77
+ height: e.hookCall.height
78
+ }), a = !1, s = !1;
71
79
  else
72
80
  throw new Error(`Unknown hook call type: ${e.hookCall?.type}`);
73
81
  }), it("should have formatter, customFilter and customSort functions", () => {
74
- t(o.formatter).toBeDefined(), a && t(o.customFilter).toBeDefined(), s && t(o.customSort).toBeDefined();
82
+ l(o.formatter).toBeDefined(), a && l(o.customFilter).toBeDefined(), s && l(o.customSort).toBeDefined();
75
83
  });
76
84
  } else
77
85
  it("should not have formatter functions", () => {
78
- t(o.formatter).toBeUndefined(), t(o.customFilter).toBeUndefined(), t(o.customSort).toBeUndefined();
86
+ l(o.formatter).toBeUndefined(), l(o.customFilter).toBeUndefined(), l(o.customSort).toBeUndefined();
79
87
  });
80
88
  });
81
89
  });
82
90
  };
83
91
  export {
84
- E as t
92
+ B as t
85
93
  };
@@ -1,7 +1,7 @@
1
- import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps, ColumnTagsFormatterProps, ColumnIconFormatterProps, ColumnColorFormatterProps } from '@m4l/components';
1
+ import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps, ColumnTagsFormatterProps, ColumnIconFormatterProps, ColumnColorFormatterProps, ColumnImageFormatterProps } 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' | 'color';
4
+ type: 'nested' | 'date' | 'boolean' | 'price' | 'points' | 'interactiveCheck' | 'setCheck' | 'uncertainty' | 'concatenated' | 'chipStatus' | 'tags' | 'icon' | 'color' | 'image';
5
5
  };
6
6
  export type TestingNestedValueHookCall<T> = BaseHookCall & ColumnNestedValueFormatterProps<T> & {
7
7
  type: 'nested';
@@ -42,8 +42,11 @@ export type TestingIconHookCall<T> = BaseHookCall & ColumnIconFormatterProps<T>
42
42
  export type TestingColorHookCall<T> = BaseHookCall & ColumnColorFormatterProps<T> & {
43
43
  type: 'color';
44
44
  };
45
+ export type TestingImageHookCall<T> = BaseHookCall & ColumnImageFormatterProps<T> & {
46
+ type: 'image';
47
+ };
45
48
  export type TestingColumnConfig<T> = BaseColumnConfig<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>;
49
+ 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> | TestingImageHookCall<T>;
47
50
  };
48
51
  export type TestingColumn = Column<unknown, unknown> & {
49
52
  testProps?: Record<string, unknown>;