@applicaster/zapp-react-native-utils 14.0.0-alpha.1235043154 → 14.0.0-alpha.1355728993

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.
Files changed (40) hide show
  1. package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
  2. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +1 -2
  3. package/analyticsUtils/index.tsx +4 -3
  4. package/analyticsUtils/manager.ts +1 -1
  5. package/arrayUtils/__tests__/isFilledArray.test.ts +1 -1
  6. package/arrayUtils/index.ts +2 -7
  7. package/configurationUtils/__tests__/configurationUtils.test.js +31 -0
  8. package/configurationUtils/index.ts +34 -63
  9. package/manifestUtils/{_internals/index.js → _internals.js} +25 -2
  10. package/manifestUtils/createConfig.js +1 -4
  11. package/manifestUtils/defaultManifestConfigurations/player.js +200 -1231
  12. package/manifestUtils/progressBar/__tests__/mobileProgressBar.test.js +30 -0
  13. package/package.json +2 -2
  14. package/playerUtils/__tests__/configurationUtils.test.ts +65 -1
  15. package/playerUtils/configurationGenerator.ts +2572 -0
  16. package/playerUtils/configurationUtils.ts +44 -0
  17. package/playerUtils/index.ts +51 -2
  18. package/playerUtils/useValidatePlayerConfig.tsx +19 -22
  19. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +13 -12
  20. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +88 -39
  21. package/reactHooks/feed/useBatchLoading.ts +2 -2
  22. package/reactHooks/navigation/index.ts +2 -2
  23. package/testUtils/index.tsx +8 -7
  24. package/utils/index.ts +1 -12
  25. package/arrayUtils/__tests__/isEmptyArray.test.ts +0 -63
  26. package/audioPlayerUtils/__tests__/getArtworkImage.test.ts +0 -144
  27. package/audioPlayerUtils/__tests__/getBackgroundImage.test.ts +0 -72
  28. package/audioPlayerUtils/__tests__/getImageFromEntry.test.ts +0 -110
  29. package/audioPlayerUtils/assets/index.ts +0 -2
  30. package/audioPlayerUtils/index.ts +0 -242
  31. package/conf/player/__tests__/selectors.test.ts +0 -34
  32. package/conf/player/selectors.ts +0 -10
  33. package/configurationUtils/__tests__/getMediaItems.test.ts +0 -65
  34. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +0 -34
  35. package/manifestUtils/_internals/getDefaultConfiguration.js +0 -28
  36. package/playerUtils/__tests__/getPlayerActionButtons.test.ts +0 -54
  37. package/playerUtils/_internals/__tests__/utils.test.ts +0 -71
  38. package/playerUtils/_internals/index.ts +0 -1
  39. package/playerUtils/_internals/utils.ts +0 -31
  40. package/playerUtils/getPlayerActionButtons.ts +0 -17
@@ -1,6 +1,50 @@
1
1
  import { parseJsonIfNeeded } from "../functionUtils";
2
2
  import * as R from "ramda";
3
3
 
4
+ import { getNativeName as nativeNameUtil } from "../localizationUtils/localeLanguage";
5
+
6
+ export const modifyDefaultConfigValues = (
7
+ configuration: ConfigurationKeys,
8
+ mapping: ConfigValuesMapping
9
+ ): DefaultConfiguration => {
10
+ return R.mapObjIndexed((value, key) => {
11
+ const isFieldlessKey = key === "custom_configuration_fields";
12
+ const keyMapping = mapping[key];
13
+ const fields = value?.fields || value;
14
+
15
+ if (!keyMapping) {
16
+ return value;
17
+ }
18
+
19
+ const mapper = (obj) => {
20
+ if (obj.fields) {
21
+ return R.mergeLeft({ fields: R.map(mapper)(obj.fields) })(obj);
22
+ }
23
+
24
+ return R.mergeLeft(keyMapping?.[obj.key])(obj);
25
+ };
26
+
27
+ const mappedFields = R.map(mapper)(fields);
28
+
29
+ return R.unless(() => isFieldlessKey, R.objOf("fields"))(mappedFields);
30
+ })(configuration);
31
+ };
32
+
33
+ export function nativeName(localeCode) {
34
+ try {
35
+ const {
36
+ getNativeName,
37
+ } = require("@applicaster/zapp-react-native-utils/localizationUtils/localeLanguage");
38
+
39
+ return getNativeName(localeCode);
40
+ } catch (error) {
41
+ // eslint-disable-next-line no-console
42
+ console.warn("Could not load localeLanguage utils from QB", error);
43
+
44
+ return nativeNameUtil(localeCode);
45
+ }
46
+ }
47
+
4
48
  const setTrackType = R.curry(
5
49
  (
6
50
  type: QuickBrickPlayer.TrackType,
@@ -5,8 +5,7 @@ import { isFilledArray } from "@applicaster/zapp-react-native-utils/arrayUtils";
5
5
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
6
6
 
7
7
  import { getBoolFromConfigValue } from "../configurationUtils";
8
-
9
- export { getPlayerActionButtons } from "./getPlayerActionButtons";
8
+ import { Dimensions } from "react-native";
10
9
 
11
10
  /**
12
11
  * Gets duration value from player manager, and from extensions
@@ -97,3 +96,53 @@ export const isAudioItem = (item: Option<ZappEntry>) => {
97
96
  export const isInlineTV = (screenData) => {
98
97
  return isTV() && isFilledArray(screenData?.ui_components);
99
98
  };
99
+
100
+ const isPercentage = (value: string | number): boolean => {
101
+ if (typeof value === "string") {
102
+ return value.includes("%");
103
+ }
104
+
105
+ return false;
106
+ };
107
+
108
+ const getPercentageOf = (percent: string, value: number) => {
109
+ const percentageValue = parseFloat(percent.replace("%", ""));
110
+
111
+ if (isNaN(percentageValue)) {
112
+ return value;
113
+ }
114
+
115
+ return (value * percentageValue) / 100;
116
+ };
117
+
118
+ type DimensionsT = {
119
+ width: number | string;
120
+ height: number | string | undefined;
121
+ aspectRatio?: number;
122
+ };
123
+
124
+ export const getTabletWidth = (
125
+ tablet_landscape_sidebar_width,
126
+ dimensions: DimensionsT
127
+ ) => {
128
+ const { width: SCREEN_WIDTH } = Dimensions.get("screen");
129
+
130
+ const { width } = dimensions;
131
+ let widthValue = Number(width);
132
+
133
+ if (isPercentage(width)) {
134
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
135
+ }
136
+
137
+ const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
138
+
139
+ if (tablet_landscape_sidebar_width?.includes("%")) {
140
+ return widthValue * (1 - sidebarWidth / 100);
141
+ }
142
+
143
+ if (Number.isNaN(sidebarWidth)) {
144
+ return widthValue * 0.65;
145
+ }
146
+
147
+ return widthValue - sidebarWidth;
148
+ };
@@ -1,37 +1,34 @@
1
1
  import * as React from "react";
2
+ import * as R from "ramda";
3
+ import generateConfiguration from "./configurationGenerator";
2
4
  import { createLogger } from "../logger";
3
- import { createConfig } from "../manifestUtils/createConfig";
4
- import { getAllFields, getConfigurationDiff } from "./_internals";
5
5
 
6
6
  export const logger = createLogger({
7
7
  category: "useValidatePlayerConfig",
8
8
  subsystem: "useValidatePlayerConfig",
9
9
  });
10
10
 
11
- /** Default Player Configuration */
12
- const {
13
- styles,
14
- general,
15
- localizations,
16
- custom_configuration_fields,
17
- }: DefaultConfiguration = createConfig(
18
- () => {
19
- return {};
20
- },
21
- { extend: "player" }
22
- ) as any;
23
-
24
- const QBPlayerConfigFields = getAllFields(
25
- styles,
26
- general,
27
- localizations,
28
- custom_configuration_fields
29
- );
11
+ const configuration = generateConfiguration();
30
12
 
31
13
  export const useValidatePlayerConfig = (config) => {
32
14
  React.useEffect(() => {
33
15
  try {
34
- const diff = getConfigurationDiff(QBPlayerConfigFields, config);
16
+ const QBPlayerConfigFields = R.compose(
17
+ R.map(R.prop("key")),
18
+ R.flatten,
19
+ R.map(R.compose(R.when(R.propEq("group", true), R.prop("fields")))),
20
+ R.concat
21
+ )(
22
+ configuration.styles.fields,
23
+ configuration.general.fields,
24
+ configuration.localizations.fields,
25
+ configuration.custom_configuration_fields
26
+ );
27
+
28
+ const diff = R.compose(
29
+ R.difference(QBPlayerConfigFields),
30
+ R.keys
31
+ )(config);
35
32
 
36
33
  logger.log_info(
37
34
  "Missing following configuration properties. Some elements of the player may not work correctly. Check QuickBrickPlayerPlugin for the configuration reference https://github.com/applicaster/QuickBrick/tree/main/plugins/zapp-react-native-default-player/manifests",
@@ -1,27 +1,25 @@
1
1
  import React from "react";
2
2
 
3
- import { renderHook } from "@testing-library/react-hooks";
4
- import { act, waitFor } from "@testing-library/react-native";
3
+ import { act, renderHook } from "@testing-library/react-hooks";
5
4
  import { Provider } from "react-redux";
6
5
  import configureStore from "redux-mock-store";
7
- import { useTrackedView } from "../useTrackedView";
8
6
 
9
7
  const mockUpdateComponentsPositions = jest.fn();
10
8
 
11
9
  jest.mock(
12
10
  "@applicaster/zapp-react-native-ui-components/Contexts/ScreenTrackedViewPositionsContext",
13
11
  () => ({
14
- useScreenTrackedViewPositionsContext: jest.fn(() => ({
12
+ useScreenTrackedViewPositionsContext: jest.fn().mockReturnValue({
15
13
  updateComponentsPositions: mockUpdateComponentsPositions,
16
14
  value: {
17
15
  "123": { componentId: "123", centerX: 0.4, centerY: 0.5 },
18
16
  "124": { componentId: "124", centerX: 0.2, centerY: 0.3 },
19
17
  },
20
- })),
18
+ }),
21
19
  })
22
20
  );
23
21
 
24
- jest.useFakeTimers();
22
+ jest.useFakeTimers({ legacyFakeTimers: true });
25
23
 
26
24
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation");
27
25
 
@@ -34,8 +32,10 @@ const Wrapper = ({ children }: { children: React.ReactChild }) => (
34
32
  <Provider store={store}>{children}</Provider>
35
33
  );
36
34
 
35
+ const { useTrackedView } = require("../useTrackedView");
36
+
37
37
  describe("useTrackCurrentAutoScrollingElement", () => {
38
- it("should update position for selected component - onViewportEnter", async () => {
38
+ it("should update position for selected component - onViewportEnter", () => {
39
39
  const { result } = renderHook(() => useTrackedView("123"), {
40
40
  wrapper: Wrapper,
41
41
  });
@@ -46,13 +46,14 @@ describe("useTrackCurrentAutoScrollingElement", () => {
46
46
  rect: { left: 1, right: 1, top: 1, bottom: 1 },
47
47
  };
48
48
 
49
- act(() => {
50
- result.current.onPositionUpdated(mockRect);
49
+ act(async () => {
50
+ await result.current.onPositionUpdated(mockRect);
51
51
  });
52
52
 
53
- await waitFor(() => {
54
- expect(result.current.inViewPort).toBe(true);
55
- });
53
+ // Fast-forward until all timers have been executed
54
+ jest.runAllTimers();
55
+
56
+ expect(result.current.inViewPort).toBe(true);
56
57
 
57
58
  expect(mockUpdateComponentsPositions).toHaveBeenCalledWith(
58
59
  "123",
@@ -1,7 +1,8 @@
1
1
  import { renderHook } from "@testing-library/react-hooks";
2
- import { allFeedsIsReady, useBatchLoading } from "../useBatchLoading";
3
- import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
4
- import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
2
+ import * as reduxMockStore from "redux-mock-store";
3
+ import thunk from "redux-thunk";
4
+ import React from "react";
5
+ import * as ReactRedux from "react-redux";
5
6
 
6
7
  jest.mock("../../navigation");
7
8
 
@@ -12,18 +13,17 @@ jest.mock(
12
13
  })
13
14
  );
14
15
 
15
- const wrapper = WrappedWithProviders;
16
+ const useBatchLoading = require("../useBatchLoading").useBatchLoading;
17
+ const allFeedsIsReady = require("../useBatchLoading").allFeedsIsReady;
18
+
19
+ const mockStore = reduxMockStore.default([thunk]);
20
+
21
+ const wrapper: React.FC<any> = ({ children, store }) => (
22
+ <ReactRedux.Provider store={store}>{children}</ReactRedux.Provider>
23
+ );
16
24
 
17
25
  describe("useBatchLoading", () => {
18
- const data = [
19
- { data: { source: "url1" }, component_type: "any" },
20
- { data: { source: "url2" }, component_type: "any" },
21
- { data: { source: "url3" }, component_type: "any" },
22
- { data: { source: "url4" }, component_type: "any" },
23
- { data: { source: "url5" }, component_type: "any" },
24
- { data: { source: "url6" }, component_type: "any" },
25
- // ... more items
26
- ];
26
+ const useDispatchSpy = jest.spyOn(ReactRedux, "useDispatch");
27
27
 
28
28
  beforeAll(() => {
29
29
  jest.useFakeTimers();
@@ -34,7 +34,7 @@ describe("useBatchLoading", () => {
34
34
  });
35
35
 
36
36
  it("loadPipesData start loading not started requests", () => {
37
- const store = {
37
+ const store = mockStore({
38
38
  zappPipes: {
39
39
  url1: {
40
40
  loading: true,
@@ -53,17 +53,29 @@ describe("useBatchLoading", () => {
53
53
  },
54
54
  },
55
55
  test: "true",
56
- };
56
+ });
57
+
58
+ useDispatchSpy.mockReturnValue(store.dispatch);
57
59
 
58
60
  const initialBatchSize = 3;
59
61
  const riverId = "123";
60
62
 
63
+ const data = [
64
+ { data: { source: "url1" } },
65
+ { data: { source: "url2" } },
66
+ { data: { source: "url3" } },
67
+ { data: { source: "url4" } },
68
+ { data: { source: "url5" } },
69
+ { data: { source: "url6" } },
70
+ // ... more items
71
+ ];
72
+
61
73
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
62
74
  wrapper,
63
75
  initialProps: { store },
64
76
  });
65
77
 
66
- const actions = (appStore.getStore() as any).getActions();
78
+ const actions = store.getActions();
67
79
 
68
80
  expect(actions).toHaveLength(2);
69
81
 
@@ -79,7 +91,7 @@ describe("useBatchLoading", () => {
79
91
  });
80
92
 
81
93
  it("loadPipesData start loading new feed when 1 feed is done loading and 1 is in loading state", () => {
82
- const store = {
94
+ const store = mockStore({
83
95
  zappPipes: {
84
96
  url1: {
85
97
  loading: false,
@@ -98,17 +110,31 @@ describe("useBatchLoading", () => {
98
110
  },
99
111
  },
100
112
  test: "true",
101
- };
113
+ });
114
+
115
+ useDispatchSpy.mockReturnValue(store.dispatch);
102
116
 
103
117
  const initialBatchSize = 3;
104
118
  const riverId = "123";
105
119
 
120
+ const data = [
121
+ { data: { source: "url1" } },
122
+ { data: { source: "url2" } },
123
+ { data: { source: "url3" } },
124
+ { data: { source: "url4" } },
125
+ { data: { source: "url5" } },
126
+ { data: { source: "url6" } },
127
+ // ... more items
128
+ ];
129
+
130
+ expect(useDispatchSpy).toBeCalledTimes(0);
131
+
106
132
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
107
133
  wrapper,
108
134
  initialProps: { store },
109
135
  });
110
136
 
111
- const actions = (appStore.getStore() as any).getActions();
137
+ const actions = store.getActions();
112
138
 
113
139
  expect(actions).toHaveLength(1);
114
140
 
@@ -119,26 +145,38 @@ describe("useBatchLoading", () => {
119
145
  });
120
146
 
121
147
  it("loadPipesData has been called when no data cached", () => {
122
- const store = {
148
+ const store = mockStore({
123
149
  zappPipes: {},
124
150
  test: "true",
125
- };
151
+ });
152
+
153
+ useDispatchSpy.mockReturnValue(store.dispatch);
126
154
 
127
155
  const initialBatchSize = 3;
128
156
  const riverId = "123";
129
157
 
158
+ const data = [
159
+ { data: { source: "url1" } },
160
+ { data: { source: "url2" } },
161
+ { data: { source: "url3" } },
162
+ { data: { source: "url4" } },
163
+ { data: { source: "url5" } },
164
+ { data: { source: "url6" } },
165
+ // ... more items
166
+ ];
167
+
130
168
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
131
169
  wrapper,
132
170
  initialProps: { store },
133
171
  });
134
172
 
135
- const actions = (appStore.getStore() as any).getActions();
173
+ const actions = store.getActions();
136
174
 
137
175
  expect(actions).toHaveLength(3);
138
176
  });
139
177
 
140
178
  it("initial batch ready when all initial items loaded", () => {
141
- const store = {
179
+ const store = mockStore({
142
180
  zappPipes: {
143
181
  url1: {
144
182
  loading: false,
@@ -156,11 +194,19 @@ describe("useBatchLoading", () => {
156
194
  data: {},
157
195
  },
158
196
  },
159
- };
197
+ });
198
+
199
+ useDispatchSpy.mockReturnValue(store.dispatch);
160
200
 
161
201
  const initialBatchSize = 3;
162
202
  const riverId = "123";
163
203
 
204
+ const data: Partial<ZappUIComponent>[] = [
205
+ { data: { source: "url1" } },
206
+ { data: { source: "url2" } },
207
+ { data: { source: "url3" } },
208
+ ];
209
+
164
210
  const { result } = renderHook(
165
211
  () => useBatchLoading(data, { initialBatchSize, riverId }),
166
212
  { wrapper, initialProps: { store } }
@@ -170,10 +216,12 @@ describe("useBatchLoading", () => {
170
216
  });
171
217
 
172
218
  it("gallery-qb: loadPipesData should be called only once for first component in the gallery", () => {
173
- const store = {
219
+ const store = mockStore({
174
220
  zappPipes: {},
175
221
  test: "true",
176
- };
222
+ });
223
+
224
+ useDispatchSpy.mockReturnValue(store.dispatch);
177
225
 
178
226
  const initialBatchSize = 3;
179
227
  const riverId = "123";
@@ -183,11 +231,11 @@ describe("useBatchLoading", () => {
183
231
  component_type: "gallery-qb",
184
232
  ui_components: [{ data: { source: "url1" } }],
185
233
  },
186
- { data: { source: "url2" }, component_type: "any" },
187
- { data: { source: "url3" }, component_type: "any" },
188
- { data: { source: "url4" }, component_type: "any" },
189
- { data: { source: "url5" }, component_type: "any" },
190
- { data: { source: "url6" }, component_type: "any" },
234
+ { data: { source: "url2" } },
235
+ { data: { source: "url3" } },
236
+ { data: { source: "url4" } },
237
+ { data: { source: "url5" } },
238
+ { data: { source: "url6" } },
191
239
  // ... more items
192
240
  ];
193
241
 
@@ -196,13 +244,13 @@ describe("useBatchLoading", () => {
196
244
  initialProps: { store },
197
245
  });
198
246
 
199
- const actions = (appStore.getStore() as any).getActions();
247
+ const actions = store.getActions();
200
248
 
201
249
  expect(actions).toHaveLength(1);
202
250
  });
203
251
 
204
252
  it("gallery-qb: initial batch ready when all initial items loaded", () => {
205
- const store = {
253
+ const store = mockStore({
206
254
  zappPipes: {
207
255
  url1: {
208
256
  loading: false,
@@ -210,19 +258,20 @@ describe("useBatchLoading", () => {
210
258
  data: {},
211
259
  },
212
260
  },
213
- };
261
+ });
262
+
263
+ useDispatchSpy.mockReturnValue(store.dispatch);
214
264
 
215
265
  const initialBatchSize = 3;
216
266
  const riverId = "123";
217
267
 
218
- const data = [
268
+ const data: Partial<ZappUIComponent>[] = [
219
269
  {
220
270
  component_type: "gallery-qb",
221
- data: {},
222
- ui_components: [{ data: { source: "url1" } }] as any,
271
+ ui_components: [{ data: { source: "url1" } }],
223
272
  },
224
- { data: { source: "url2" }, component_type: "any" },
225
- { data: { source: "url3" }, component_type: "any" },
273
+ { data: { source: "url2" } },
274
+ { data: { source: "url3" } },
226
275
  ];
227
276
 
228
277
  const { result } = renderHook(
@@ -144,11 +144,11 @@ export const useBatchLoading = (
144
144
  }
145
145
  }
146
146
  });
147
- }, [feedUrls, feeds]);
147
+ }, [feedUrls]);
148
148
 
149
149
  React.useEffect(() => {
150
150
  runBatchLoading();
151
- }, [runBatchLoading]); // Adding runBatchLoading as a dependency to ensure that it reloads feeds when clearPipesData is called
151
+ }, []);
152
152
 
153
153
  React.useEffect(() => {
154
154
  // check if all feeds are ready and set hasEverBeenReady to true
@@ -127,10 +127,10 @@ export function isNavBarVisible(
127
127
 
128
128
  export const useBackHandler = (cb: () => boolean) => {
129
129
  useEffect(() => {
130
- const unsubscribe = BackHandler.addEventListener("hardwareBackPress", cb);
130
+ BackHandler.addEventListener("hardwareBackPress", cb);
131
131
 
132
132
  return () => {
133
- unsubscribe.remove();
133
+ BackHandler.removeEventListener("hardwareBackPress", cb);
134
134
  };
135
135
  }, [cb]);
136
136
  };
@@ -1,16 +1,17 @@
1
- import { SafeAreaProvider } from "react-native-safe-area-context";
2
- import { render } from "@testing-library/react-native";
1
+ import * as R from "ramda";
2
+
3
3
  import React, { PropsWithChildren } from "react";
4
- import configureStore from "redux-mock-store";
5
- import { Provider } from "react-redux";
6
4
  import { View } from "react-native";
7
- import thunk from "redux-thunk";
8
- import * as R from "ramda";
9
5
 
6
+ import { Provider } from "react-redux";
7
+ import thunk from "redux-thunk";
8
+ import configureStore from "redux-mock-store";
9
+ import { SafeAreaProvider } from "react-native-safe-area-context";
10
10
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
11
11
 
12
- import { ThemeContext } from "../theme";
12
+ import { render } from "@testing-library/react-native";
13
13
  import { AnalyticsProvider } from "../analyticsUtils";
14
+ import { ThemeContext } from "../theme";
14
15
 
15
16
  export { getByTestId } from "./getByTestId";
16
17
 
package/utils/index.ts CHANGED
@@ -2,15 +2,4 @@ export { chunk } from "./chunk";
2
2
 
3
3
  export { times } from "./times";
4
4
 
5
- export {
6
- cloneDeep as clone,
7
- flatten,
8
- drop,
9
- size,
10
- isNil,
11
- isEmpty,
12
- get,
13
- has,
14
- flatMap,
15
- difference,
16
- } from "lodash";
5
+ export { cloneDeep as clone, flatten, drop, size, isNil } from "lodash";
@@ -1,63 +0,0 @@
1
- import { isEmptyArray } from "..";
2
-
3
- describe("isEmptyArray", () => {
4
- it("non-empty array is not empty", () => {
5
- const value = [1, 2, 3];
6
-
7
- expect(isEmptyArray(value)).toBe(false);
8
- });
9
-
10
- it("empty array is empty", () => {
11
- const value = [];
12
-
13
- expect(isEmptyArray(value)).toBe(true);
14
- });
15
-
16
- it("number is not array", () => {
17
- const value = 123;
18
-
19
- expect(isEmptyArray(value)).toBe(false);
20
- });
21
-
22
- it("string is not array", () => {
23
- const value = "vfnjdk";
24
-
25
- expect(isEmptyArray(value)).toBe(false);
26
- });
27
-
28
- it("empty string is not array", () => {
29
- const value = "";
30
-
31
- expect(isEmptyArray(value)).toBe(false);
32
- });
33
-
34
- it("NaN is not array", () => {
35
- const value = NaN;
36
-
37
- expect(isEmptyArray(value)).toBe(false);
38
- });
39
-
40
- it("object is not array", () => {
41
- const value = { test: 1 };
42
-
43
- expect(isEmptyArray(value)).toBe(false);
44
- });
45
-
46
- it("empty object is not array", () => {
47
- const value = {};
48
-
49
- expect(isEmptyArray(value)).toBe(false);
50
- });
51
-
52
- it("undefined is not array", () => {
53
- const value = undefined;
54
-
55
- expect(isEmptyArray(value)).toBe(false);
56
- });
57
-
58
- it("null is not array", () => {
59
- const value = null;
60
-
61
- expect(isEmptyArray(value)).toBe(false);
62
- });
63
- });