Skip to content

Commit 298bcfb

Browse files
committed
Enhances readability of matrix and test
1 parent ee95f3f commit 298bcfb

File tree

1 file changed

+30
-18
lines changed
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components

1 file changed

+30
-18
lines changed

app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/utils.test.ts

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,47 @@ import type { SelectOptionProps } from "@appsmith/ads";
1111

1212
describe("getRunBehaviorOptions", () => {
1313
it("should return the correct options", () => {
14-
const flagsOutputMatrix: [boolean, boolean, SelectOptionProps[]][] = [
15-
[true, true, RUN_BEHAVIOR_VALUES],
16-
[
17-
false,
18-
true,
19-
RUN_BEHAVIOR_VALUES.filter(
14+
const flagsOutputMatrix: {
15+
isReactiveActionsEnabled: boolean;
16+
isOnPageUnloadEnabled: boolean;
17+
expectedOptions: SelectOptionProps[];
18+
}[] = [
19+
{
20+
isReactiveActionsEnabled: true,
21+
isOnPageUnloadEnabled: true,
22+
expectedOptions: RUN_BEHAVIOR_VALUES,
23+
},
24+
{
25+
isReactiveActionsEnabled: false,
26+
isOnPageUnloadEnabled: true,
27+
expectedOptions: RUN_BEHAVIOR_VALUES.filter(
2028
(option) => option.value !== ActionRunBehaviour.AUTOMATIC,
2129
),
22-
],
23-
[
24-
true,
25-
false,
26-
RUN_BEHAVIOR_VALUES.filter(
30+
},
31+
{
32+
isReactiveActionsEnabled: true,
33+
isOnPageUnloadEnabled: false,
34+
expectedOptions: RUN_BEHAVIOR_VALUES.filter(
2735
(option) => option.value !== ActionRunBehaviour.ON_PAGE_UNLOAD,
2836
),
29-
],
30-
[
31-
false,
32-
false,
33-
RUN_BEHAVIOR_VALUES.filter(
37+
},
38+
{
39+
isReactiveActionsEnabled: false,
40+
isOnPageUnloadEnabled: false,
41+
expectedOptions: RUN_BEHAVIOR_VALUES.filter(
3442
(option) =>
3543
option.value !== ActionRunBehaviour.AUTOMATIC &&
3644
option.value !== ActionRunBehaviour.ON_PAGE_UNLOAD,
3745
),
38-
],
46+
},
3947
];
4048

4149
flagsOutputMatrix.forEach(
42-
([isReactiveActionsEnabled, isOnPageUnloadEnabled, expectedOptions]) => {
50+
({
51+
expectedOptions,
52+
isOnPageUnloadEnabled,
53+
isReactiveActionsEnabled,
54+
}) => {
4355
const options = getRunBehaviorOptionsBasedOnFeatureFlags(
4456
isReactiveActionsEnabled,
4557
isOnPageUnloadEnabled,

0 commit comments

Comments
 (0)