@truedat/qx 5.14.1 → 5.15.0
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 +3 -3
- package/src/api.js +3 -2
- package/src/components/QxRoutes.js +4 -4
- package/src/components/common/ResourceSelector.js +80 -0
- package/src/components/common/TestFormWrapper.js +9 -6
- package/src/components/common/TypeSelector.js +3 -1
- package/src/components/common/__tests__/DescriptionInput.spec.js +48 -0
- package/src/components/common/__tests__/ResourceSelector.spec.js +124 -0
- package/src/components/common/__tests__/TypeSelector.spec.js +29 -0
- package/src/components/common/__tests__/__snapshots__/DescriptionInput.spec.js.snap +19 -0
- package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +484 -0
- package/src/components/common/__tests__/__snapshots__/TypeSelector.spec.js.snap +230 -0
- package/src/components/common/expressions/Clauses.js +100 -0
- package/src/components/common/expressions/Condition.js +178 -0
- package/src/components/common/expressions/Expression.js +54 -0
- package/src/components/common/expressions/FieldSelector.js +66 -0
- package/src/components/{functions → common}/expressions/FunctionArgs.js +1 -0
- package/src/components/{functions → common}/expressions/FunctionSelector.js +24 -4
- package/src/components/{functions → common}/expressions/ParamSelector.js +3 -3
- package/src/components/{functions → common}/expressions/ShapeSelector.js +22 -6
- package/src/components/common/expressions/__tests__/Clauses.spec.js +53 -0
- package/src/components/common/expressions/__tests__/Condition.spec.js +33 -0
- package/src/components/{functions → common}/expressions/__tests__/ConstantSelector.spec.js +6 -1
- package/src/components/{functions → common}/expressions/__tests__/Expression.spec.js +7 -5
- package/src/components/common/expressions/__tests__/FieldSelector.spec.js +24 -0
- package/src/components/{functions → common}/expressions/__tests__/FunctionArgs.spec.js +20 -6
- package/src/components/{functions → common}/expressions/__tests__/FunctionSelector.spec.js +1 -1
- package/src/components/{functions → common}/expressions/__tests__/ParamSelector.spec.js +22 -10
- package/src/components/{functions → common}/expressions/__tests__/ShapeSelector.spec.js +3 -3
- package/src/components/common/expressions/__tests__/__snapshots__/Clauses.spec.js.snap +64 -0
- package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +316 -0
- package/src/components/{functions → common}/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap +1 -1
- package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +939 -0
- package/src/components/common/expressions/__tests__/__snapshots__/FieldSelector.spec.js.snap +5 -0
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +344 -0
- package/src/components/{functions → common}/expressions/__tests__/__snapshots__/ParamSelector.spec.js.snap +4 -4
- package/src/components/{functions → common}/expressions/__tests__/__snapshots__/ShapeSelector.spec.js.snap +17 -24
- package/src/components/common/expressions/constantInputs/AnySelector.js +44 -0
- package/src/components/{functions → common}/expressions/constantInputs/__tests__/AnySelector.spec.js +21 -14
- package/src/components/{functions → common}/expressions/constantInputs/__tests__/DefaultSelector.spec.js +5 -2
- package/src/components/{functions → common}/expressions/constantInputs/__tests__/__snapshots__/AnySelector.spec.js.snap +2 -2
- package/src/components/common/expressions/index.js +4 -0
- package/src/components/common/resourceSelectors/DataStructureSelector.js +63 -0
- package/src/components/common/resourceSelectors/DataViewSelector.js +65 -0
- package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +61 -0
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +31 -0
- package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +133 -0
- package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +97 -0
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +105 -0
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataViewSelector.spec.js.snap +50 -0
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/ReferenceDatasetSelector.spec.js.snap +50 -0
- package/src/components/common/resourceSelectors/index.js +5 -0
- package/src/components/dataViews/DataViewEditor.js +170 -0
- package/src/components/dataViews/DataViewSelect.js +47 -0
- package/src/components/dataViews/DataViews.js +169 -0
- package/src/components/dataViews/Queryable.js +138 -0
- package/src/components/dataViews/Queryables.js +53 -0
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +293 -0
- package/src/components/dataViews/__tests__/DataViewSelect.spec.js +28 -0
- package/src/components/dataViews/__tests__/DataViews.spec.js +57 -0
- package/src/components/dataViews/__tests__/Queryable.spec.js +201 -0
- package/src/components/dataViews/__tests__/Queryables.spec.js +183 -0
- package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +1000 -0
- package/src/components/dataViews/__tests__/__snapshots__/DataViewSelect.spec.js.snap +55 -0
- package/src/components/dataViews/__tests__/__snapshots__/DataViews.spec.js.snap +77 -0
- package/src/components/dataViews/__tests__/__snapshots__/Queryable.spec.js.snap +874 -0
- package/src/components/dataViews/__tests__/__snapshots__/Queryables.spec.js.snap +911 -0
- package/src/components/dataViews/__tests__/queryableFunctions.spec.js +193 -0
- package/src/components/dataViews/queryableFunctions.js +80 -0
- package/src/components/dataViews/queryableProperties/From.js +15 -0
- package/src/components/dataViews/queryableProperties/GroupBy.js +124 -0
- package/src/components/dataViews/queryableProperties/Join.js +62 -0
- package/src/components/dataViews/queryableProperties/JoinTypeIcon.js +49 -0
- package/src/components/dataViews/queryableProperties/Select.js +76 -0
- package/src/components/dataViews/queryableProperties/SelectField.js +116 -0
- package/src/components/dataViews/queryableProperties/Where.js +15 -0
- package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +30 -0
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +75 -0
- package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +38 -0
- package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +36 -0
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +144 -0
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +107 -0
- package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +27 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/From.spec.js.snap +75 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +276 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Join.spec.js.snap +252 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/JoinTypeIcon.spec.js.snap +77 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Select.spec.js.snap +411 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/SelectField.spec.js.snap +343 -0
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Where.spec.js.snap +22 -0
- package/src/components/dataViews/queryableProperties/index.js +7 -0
- package/src/components/functions/FunctionEditor.js +30 -29
- package/src/components/functions/Functions.js +3 -11
- package/src/components/functions/__tests__/FunctionEditor.spec.js +6 -0
- package/src/components/functions/__tests__/FunctionParams.spec.js +6 -0
- package/src/components/functions/__tests__/__snapshots__/FunctionEditor.spec.js.snap +490 -466
- package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +1 -1
- package/src/hooks/__tests__/{useDataSets.spec.js → useDataViews.spec.js} +5 -5
- package/src/hooks/useDataViews.js +33 -0
- package/src/styles/Expression.less +150 -0
- package/src/types.js +11 -3
- package/src/components/DataSets.js +0 -64
- package/src/components/__tests__/DataSets.spec.js +0 -46
- package/src/components/__tests__/__snapshots__/DataSets.spec.js.snap +0 -82
- package/src/components/functions/expressions/Expression.js +0 -40
- package/src/components/functions/expressions/FieldSelector.js +0 -56
- package/src/components/functions/expressions/__tests__/__snapshots__/Expression.spec.js.snap +0 -904
- package/src/components/functions/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +0 -392
- package/src/components/functions/expressions/constantInputs/AnySelector.js +0 -29
- package/src/hooks/useDataSets.js +0 -8
- /package/src/components/{functions → common}/expressions/ConstantSelector.js +0 -0
- /package/src/components/{functions → common}/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +0 -0
- /package/src/components/{functions → common/expressions}/__tests__/useWatchParams.spec.js +0 -0
- /package/src/components/{functions → common}/expressions/constantInputs/BooleanSelector.js +0 -0
- /package/src/components/{functions → common}/expressions/constantInputs/DefaultSelector.js +0 -0
- /package/src/components/{functions → common}/expressions/constantInputs/__tests__/BooleanSelector.spec.js +0 -0
- /package/src/components/{functions → common}/expressions/constantInputs/__tests__/__snapshots__/BooleanSelector.spec.js.snap +0 -0
- /package/src/components/{functions → common}/expressions/constantInputs/__tests__/__snapshots__/DefaultSelector.spec.js.snap +0 -0
- /package/src/components/{functions → common}/expressions/constantInputs/index.js +0 -0
- /package/src/components/{functions → common/expressions}/useWatchParams.js +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { act } from "react-dom/test-utils";
|
|
4
|
+
import userEvent from "@testing-library/user-event";
|
|
5
|
+
import { render } from "@truedat/test/render";
|
|
6
|
+
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
7
|
+
import Queryables from "../Queryables";
|
|
8
|
+
|
|
9
|
+
const renderOpts = {
|
|
10
|
+
messages: {
|
|
11
|
+
en: {
|
|
12
|
+
"dataViews.form.error.empty_select": "empty_select",
|
|
13
|
+
"dataViews.form.error.empty_select": "empty_select",
|
|
14
|
+
"dataViews.form.queryable.alias": "alias",
|
|
15
|
+
"dataViews.form.queryable.from": "from",
|
|
16
|
+
"dataViews.form.queryable.group_by": "group_by",
|
|
17
|
+
"dataViews.form.queryable.join": "join",
|
|
18
|
+
"dataViews.form.queryable.select": "select",
|
|
19
|
+
"dataViews.form.queryable.where": "where",
|
|
20
|
+
"expression.clause.action.addGroup": "addGroup",
|
|
21
|
+
"expression.form.clause": "clause",
|
|
22
|
+
"joinType.full_outer": "full_outer",
|
|
23
|
+
"joinType.inner": "inner",
|
|
24
|
+
"joinType.left": "left",
|
|
25
|
+
"joinType.right": "right",
|
|
26
|
+
"queryables.form.join.type": "type",
|
|
27
|
+
"queryables.form.resource": "resource",
|
|
28
|
+
"queryables.group_by.form.add_aggregate_field": "add_aggregate_field",
|
|
29
|
+
"queryables.group_by.form.add_group_field": "add_group_field",
|
|
30
|
+
"queryables.group_by.form.aggregate_fields": "aggregate_fields",
|
|
31
|
+
"queryables.group_by.form.group_fields": "group_fields",
|
|
32
|
+
"queryables.resource.selector.data_view": "data_view",
|
|
33
|
+
"queryables.resource.type.data_structure": "data_structure",
|
|
34
|
+
"queryables.resource.type.data_view": "data_view",
|
|
35
|
+
"queryables.resource.type.reference_dataset": "reference_dataset",
|
|
36
|
+
"queryables.resource.type": "type",
|
|
37
|
+
"queryables.select.form.add_all_select_fields": "add_all_select_fields",
|
|
38
|
+
"queryables.select.form.add_select_field": "add_select_field",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
describe("<Queryables />", () => {
|
|
44
|
+
it("matches the latest snapshot with from queryable", () => {
|
|
45
|
+
const { container } = render(
|
|
46
|
+
<TestFormWrapper
|
|
47
|
+
defaultValues={{
|
|
48
|
+
queryables: [
|
|
49
|
+
{
|
|
50
|
+
id: 0,
|
|
51
|
+
alias: "",
|
|
52
|
+
type: "from",
|
|
53
|
+
properties: {
|
|
54
|
+
resource: null,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<Queryables />
|
|
61
|
+
</TestFormWrapper>,
|
|
62
|
+
renderOpts
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(container).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("matches the latest snapshot with join queryable", () => {
|
|
69
|
+
const { container } = render(
|
|
70
|
+
<TestFormWrapper
|
|
71
|
+
defaultValues={{
|
|
72
|
+
queryables: [
|
|
73
|
+
{
|
|
74
|
+
id: 0,
|
|
75
|
+
alias: "",
|
|
76
|
+
type: "join",
|
|
77
|
+
properties: {
|
|
78
|
+
resource: null,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Queryables />
|
|
85
|
+
</TestFormWrapper>,
|
|
86
|
+
renderOpts
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
expect(container).toMatchSnapshot();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("matches the latest snapshot with select queryable", () => {
|
|
93
|
+
const { container } = render(
|
|
94
|
+
<TestFormWrapper
|
|
95
|
+
defaultValues={{
|
|
96
|
+
queryables: [
|
|
97
|
+
{
|
|
98
|
+
id: 0,
|
|
99
|
+
alias: "",
|
|
100
|
+
type: "select",
|
|
101
|
+
properties: {
|
|
102
|
+
fields: [],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<Queryables />
|
|
109
|
+
</TestFormWrapper>,
|
|
110
|
+
renderOpts
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
expect(container).toMatchSnapshot();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("matches the latest snapshot with from queryable", () => {
|
|
117
|
+
const { container } = render(
|
|
118
|
+
<TestFormWrapper
|
|
119
|
+
defaultValues={{
|
|
120
|
+
queryables: [
|
|
121
|
+
{
|
|
122
|
+
id: 0,
|
|
123
|
+
alias: "",
|
|
124
|
+
type: "group_by",
|
|
125
|
+
properties: {
|
|
126
|
+
group_fields: [],
|
|
127
|
+
aggregate_fields: [],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<Queryables />
|
|
134
|
+
</TestFormWrapper>,
|
|
135
|
+
renderOpts
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
expect(container).toMatchSnapshot();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("test delete queryable", async () => {
|
|
142
|
+
const { container, getByRole, getAllByRole, queryByText } = render(
|
|
143
|
+
<TestFormWrapper
|
|
144
|
+
defaultValues={{
|
|
145
|
+
queryables: [
|
|
146
|
+
{
|
|
147
|
+
id: 0,
|
|
148
|
+
alias: "",
|
|
149
|
+
type: "from",
|
|
150
|
+
properties: {
|
|
151
|
+
resource: null,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: 0,
|
|
156
|
+
alias: "",
|
|
157
|
+
type: "group_by",
|
|
158
|
+
properties: {
|
|
159
|
+
group_fields: [],
|
|
160
|
+
aggregate_fields: [],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
<Queryables />
|
|
167
|
+
</TestFormWrapper>,
|
|
168
|
+
renderOpts
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
userEvent.hover(getAllByRole("textbox")[1]);
|
|
172
|
+
|
|
173
|
+
await act(async () => {
|
|
174
|
+
userEvent.click(getByRole("button", { name: /delete/i }));
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
await waitFor(() =>
|
|
178
|
+
expect(queryByText(/add_group_field/i)).not.toBeInTheDocument()
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
expect(container).toMatchSnapshot();
|
|
182
|
+
});
|
|
183
|
+
});
|