@quillsql/react 2.12.31 → 2.12.33

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 (44) hide show
  1. package/dist/cjs/hooks/useQuill.d.ts.map +1 -1
  2. package/dist/cjs/hooks/useQuill.js +2 -2
  3. package/dist/cjs/utils/dataProcessing.d.ts +1 -1
  4. package/dist/cjs/utils/dataProcessing.d.ts.map +1 -1
  5. package/dist/cjs/utils/dataProcessing.js +7 -1
  6. package/dist/esm/hooks/useQuill.d.ts.map +1 -1
  7. package/dist/esm/hooks/useQuill.js +3 -3
  8. package/dist/esm/utils/dataProcessing.d.ts +1 -1
  9. package/dist/esm/utils/dataProcessing.d.ts.map +1 -1
  10. package/dist/esm/utils/dataProcessing.js +7 -1
  11. package/package.json +1 -1
  12. package/dist/esm/components/ReportBuilder/convert.uspec.d.ts +0 -2
  13. package/dist/esm/components/ReportBuilder/convert.uspec.d.ts.map +0 -1
  14. package/dist/esm/components/ReportBuilder/convert.uspec.js +0 -1419
  15. package/dist/esm/test-utils/constants.d.ts +0 -56
  16. package/dist/esm/test-utils/constants.d.ts.map +0 -1
  17. package/dist/esm/test-utils/constants.js +0 -271
  18. package/dist/esm/test-utils/generators.d.ts +0 -4
  19. package/dist/esm/test-utils/generators.d.ts.map +0 -1
  20. package/dist/esm/test-utils/generators.js +0 -37
  21. package/dist/esm/utils/astFilterProcessing.uspec.d.ts +0 -2
  22. package/dist/esm/utils/astFilterProcessing.uspec.d.ts.map +0 -1
  23. package/dist/esm/utils/astFilterProcessing.uspec.js +0 -2877
  24. package/dist/esm/utils/columnProcessing.uspec.d.ts +0 -2
  25. package/dist/esm/utils/columnProcessing.uspec.d.ts.map +0 -1
  26. package/dist/esm/utils/columnProcessing.uspec.js +0 -65
  27. package/dist/esm/utils/dataProcessing.uspec.d.ts +0 -2
  28. package/dist/esm/utils/dataProcessing.uspec.d.ts.map +0 -1
  29. package/dist/esm/utils/dataProcessing.uspec.js +0 -205
  30. package/dist/esm/utils/filterProcessing.uspec.d.ts +0 -2
  31. package/dist/esm/utils/filterProcessing.uspec.d.ts.map +0 -1
  32. package/dist/esm/utils/filterProcessing.uspec.js +0 -245
  33. package/dist/esm/utils/queryConstructor.uspec.d.ts +0 -2
  34. package/dist/esm/utils/queryConstructor.uspec.d.ts.map +0 -1
  35. package/dist/esm/utils/queryConstructor.uspec.js +0 -223
  36. package/dist/esm/utils/report.ispec.d.ts +0 -2
  37. package/dist/esm/utils/report.ispec.d.ts.map +0 -1
  38. package/dist/esm/utils/report.ispec.js +0 -46
  39. package/dist/esm/utils/report.uspec.d.ts +0 -2
  40. package/dist/esm/utils/report.uspec.d.ts.map +0 -1
  41. package/dist/esm/utils/report.uspec.js +0 -66
  42. package/dist/esm/utils/tableProcessing.ispec.d.ts +0 -2
  43. package/dist/esm/utils/tableProcessing.ispec.d.ts.map +0 -1
  44. package/dist/esm/utils/tableProcessing.ispec.js +0 -61
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=columnProcessing.uspec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"columnProcessing.uspec.d.ts","sourceRoot":"","sources":["../../../src/utils/columnProcessing.uspec.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- import { DEFAULT_COMPARISON_DATE_FILTER, TWO_D_PIVOT, GENERIC_REPORT_INTERNAL, ONE_D_PIVOT, } from '../test-utils/constants';
2
- import { createRows } from '../test-utils/generators';
3
- import { getYAxisFields } from './columnProcessing';
4
- describe('columnProcessing', () => {
5
- describe('getYAxisFields', () => {
6
- it('should return an array of fields for generic reports', () => {
7
- const internalReport = {
8
- ...GENERIC_REPORT_INTERNAL,
9
- rows: createRows(GENERIC_REPORT_INTERNAL.columns, 10),
10
- };
11
- const result = getYAxisFields(internalReport);
12
- expect(result).toEqual([
13
- { field: 'id', format: 'whole_number', label: 'ID' },
14
- ]);
15
- });
16
- it('should return an array of fields for comparison reports', () => {
17
- const internalReport = {
18
- ...GENERIC_REPORT_INTERNAL,
19
- rows: createRows(GENERIC_REPORT_INTERNAL.columns, 10),
20
- compareRows: createRows(GENERIC_REPORT_INTERNAL.columns, 10),
21
- filtersApplied: [DEFAULT_COMPARISON_DATE_FILTER],
22
- };
23
- const result = getYAxisFields(internalReport);
24
- expect(result).toEqual([
25
- { field: 'id', format: 'whole_number', label: 'ID' },
26
- {
27
- field: 'comparison_id',
28
- format: 'whole_number',
29
- label: 'comparison ID',
30
- },
31
- ]);
32
- });
33
- it('should return the proper fields for a 2d pivot report', () => {
34
- const internalReport = {
35
- ...GENERIC_REPORT_INTERNAL,
36
- rows: createRows(GENERIC_REPORT_INTERNAL.columns, 10),
37
- pivotColumns: TWO_D_PIVOT.pivotColumns,
38
- pivotRows: TWO_D_PIVOT.pivotRows,
39
- pivot: TWO_D_PIVOT.pivot,
40
- };
41
- const result = getYAxisFields(internalReport);
42
- expect(result).toEqual([
43
- { field: 'Food', format: 'whole_number', label: 'Food' },
44
- { field: 'Fuel', format: 'whole_number', label: 'Fuel' },
45
- { field: 'Other', format: 'whole_number', label: 'Other' },
46
- ]);
47
- });
48
- it('should return the proper fields for a 1d pivot report', () => {
49
- const internalReport = {
50
- ...GENERIC_REPORT_INTERNAL,
51
- rows: createRows(GENERIC_REPORT_INTERNAL.columns, 10),
52
- pivotColumns: ONE_D_PIVOT.pivotColumns,
53
- pivotRows: ONE_D_PIVOT.pivotRows,
54
- pivot: ONE_D_PIVOT.pivot,
55
- yAxisFields: [
56
- { field: 'amount', format: 'whole_number', label: 'Amount' },
57
- ],
58
- };
59
- const result = getYAxisFields(internalReport);
60
- expect(result).toEqual([
61
- { field: 'amount', format: 'whole_number', label: 'Amount' },
62
- ]);
63
- });
64
- });
65
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=dataProcessing.uspec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataProcessing.uspec.d.ts","sourceRoot":"","sources":["../../../src/utils/dataProcessing.uspec.ts"],"names":[],"mappings":""}
@@ -1,205 +0,0 @@
1
- import { getPointToPointPercentageChange, getSimplePercentageChange, } from './dataProcessing';
2
- const defaultReport = {
3
- id: 'dummy',
4
- name: 'dummy',
5
- dashboardName: 'dummy',
6
- chartType: 'dummy',
7
- dateField: null,
8
- columns: [],
9
- filtersApplied: [],
10
- order: 0,
11
- queryString: 'dummy',
12
- compareRows: [{ amount: '20' }, { amount: '20' }],
13
- rowCount: 0,
14
- pivot: null,
15
- rows: [
16
- { amount: '40', created_at: '2024-06-01' },
17
- { amount: '20', created_at: '2024-07-02' },
18
- ],
19
- xAxisField: 'date',
20
- xAxisFormat: 'string',
21
- xAxisLabel: 'Date',
22
- yAxisFields: [{ field: 'amount', label: 'Amount', format: 'string' }],
23
- };
24
- describe('getSimplePercentageChange', () => {
25
- it('should get the simple percentage without a pivot', () => {
26
- const result = getSimplePercentageChange(defaultReport);
27
- expect(result).toEqual(0.5);
28
- });
29
- it('should get the simple percentage with 1D pivot', () => {
30
- const report = {
31
- ...defaultReport,
32
- pivot: {
33
- title: 'dummy',
34
- aggregationType: 'sum',
35
- rowField: 'merchant',
36
- rowFieldType: 'dummy',
37
- columnField: 'dummy',
38
- columnFieldType: 'dummy',
39
- valueField: 'amount',
40
- valueFieldType: 'number',
41
- },
42
- pivotRows: [
43
- { merchant: 'dummy-merchant', amount: 15, comparison_amount: 10 },
44
- ],
45
- pivotColumns: [
46
- { field: 'comparison_amount', label: 'Amount', format: 'string' },
47
- { field: 'amount', label: 'Amount', format: 'string' },
48
- { field: 'merchant', label: 'Merchant', format: 'string' },
49
- ],
50
- };
51
- // @ts-ignore
52
- const result = getSimplePercentageChange(report);
53
- expect(result).toEqual(0.5);
54
- });
55
- it('should get the simple percentage with 1D pivot', () => {
56
- const report = {
57
- ...defaultReport,
58
- pivot: {
59
- title: 'dummy',
60
- aggregationType: 'sum',
61
- rowField: 'merchant',
62
- rowFieldType: 'string',
63
- columnField: 'user_name',
64
- columnFieldType: 'string',
65
- valueField: 'amount',
66
- valueFieldType: 'number',
67
- },
68
- pivotRows: [{ dummy: 'subway', subway: 15, comparison_subway: 10 }],
69
- pivotColumns: [
70
- { label: 'dummy', field: 'user_name' },
71
- { label: 'subway', field: 'subway' },
72
- { label: 'comparison_subway', field: 'comparison_subway' },
73
- ],
74
- };
75
- // @ts-ignore
76
- const result = getSimplePercentageChange(report);
77
- expect(result).toEqual(0.5);
78
- });
79
- it('should fallback to point to point', () => {
80
- const report = {
81
- ...defaultReport,
82
- compareRows: null,
83
- pivot: {
84
- title: 'dummy',
85
- aggregationType: 'sum',
86
- rowField: 'merchant',
87
- rowFieldType: 'string',
88
- columnField: 'user_name',
89
- columnFieldType: 'string',
90
- valueField: 'amount',
91
- valueFieldType: 'number',
92
- },
93
- dateField: { table: 'table', field: 'created_at' },
94
- pivotRows: [{ dummy: 'subway', subway: 15, comparison_subway: 10 }],
95
- pivotColumns: [
96
- { label: 'dummy', field: 'user_name' },
97
- { label: 'subway', field: 'subway' },
98
- { label: 'comparison_subway', field: 'comparison_subway' },
99
- ],
100
- };
101
- //@ts-ignore
102
- const result = getSimplePercentageChange(report);
103
- expect(result).toEqual(-1);
104
- });
105
- });
106
- describe('getPointToPointPercentageChange', () => {
107
- it('should get the point to point percentage change', () => {
108
- const report = {
109
- ...defaultReport,
110
- compareRows: [],
111
- dateField: { table: 'table', field: 'created_at' },
112
- };
113
- const result = getPointToPointPercentageChange(report);
114
- expect(result).toEqual(-1);
115
- });
116
- it('should work with 1d date pivots', () => {
117
- const report = {
118
- ...defaultReport,
119
- compareRows: [],
120
- dateField: { table: 'table', field: 'created_at' },
121
- pivot: {
122
- title: 'dummy',
123
- aggregationType: 'sum',
124
- rowField: 'created_at',
125
- rowFieldType: 'date',
126
- columnField: 'user_name',
127
- columnFieldType: 'string',
128
- valueField: 'amount',
129
- valueFieldType: 'number',
130
- },
131
- pivotRows: [
132
- { created_at: '2024-01-01', amount: '20' },
133
- { created_at: '2024-02-01', amount: '30' },
134
- ],
135
- pivotColumns: [
136
- { label: 'created_at', field: 'created_at' },
137
- { label: 'amount', field: 'amount' },
138
- ],
139
- };
140
- // @ts-ignore
141
- const result = getPointToPointPercentageChange(report);
142
- expect(result).toEqual(0.5);
143
- });
144
- it('should only use the first and last buckets', () => {
145
- const report = {
146
- ...defaultReport,
147
- compareRows: [],
148
- dateField: { table: 'table', field: 'created_at' },
149
- pivot: {
150
- title: 'dummy',
151
- aggregationType: 'sum',
152
- rowField: 'created_at',
153
- rowFieldType: 'date',
154
- columnField: 'user_name',
155
- columnFieldType: 'string',
156
- valueField: 'amount',
157
- valueFieldType: 'number',
158
- },
159
- pivotRows: [
160
- { created_at: '2024-01-01', amount: '20' },
161
- { created_at: '2024-02-01', amount: '20' },
162
- { created_at: '2024-03-01', amount: '30' },
163
- { created_at: '2024-05-01', amount: '40' },
164
- ],
165
- pivotColumns: [
166
- { label: 'created_at', field: 'created_at' },
167
- { label: 'amount', field: 'amount' },
168
- ],
169
- };
170
- // @ts-ignore
171
- const result = getPointToPointPercentageChange(report);
172
- expect(result).toEqual(1);
173
- });
174
- it('should work with 2d pivots', () => {
175
- const report = {
176
- ...defaultReport,
177
- compareRows: [],
178
- dateField: { table: 'table', field: 'created_at' },
179
- pivot: {
180
- title: 'dummy',
181
- aggregationType: 'sum',
182
- rowField: 'created_at',
183
- rowFieldType: 'date',
184
- columnField: 'user_name',
185
- columnFieldType: 'string',
186
- valueField: 'amount',
187
- valueFieldType: 'number',
188
- },
189
- pivotRows: [
190
- { created_at: '2024-01-01', subway: '20', mcdonalds: '30' },
191
- { created_at: '2024-02-01', subway: '20', mcdonalds: '30' },
192
- { created_at: '2024-03-01', subway: '30', mcdonalds: '30' },
193
- { created_at: '2024-04-01', subway: '50', mcdonalds: '100' },
194
- ],
195
- pivotColumns: [
196
- { label: 'created_at', field: 'created_at' },
197
- { label: 'subway', field: 'subway' },
198
- { label: 'mcdonalds', field: 'mcdonalds' },
199
- ],
200
- };
201
- // @ts-ignore
202
- const result = getPointToPointPercentageChange(report);
203
- expect(result).toEqual(2);
204
- });
205
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=filterProcessing.uspec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filterProcessing.uspec.d.ts","sourceRoot":"","sources":["../../../src/utils/filterProcessing.uspec.ts"],"names":[],"mappings":""}
@@ -1,245 +0,0 @@
1
- import { BoolOperator, DateOperator, FieldTypes, FilterNames, NullOperator, NumberOperator, StringOperator, } from '../models/Filter';
2
- import { filterSentence } from './filterProcessing';
3
- describe('filterSentence', () => {
4
- it('should handle null filters', () => {
5
- const isNullFilter = {
6
- name: FilterNames.NullFilter,
7
- operator: NullOperator.IsNull,
8
- field: 'field',
9
- type: FieldTypes.Null,
10
- value: null,
11
- };
12
- const isNotNullFilter = {
13
- name: FilterNames.NullFilter,
14
- operator: NullOperator.IsNotNull,
15
- field: 'field',
16
- type: FieldTypes.Null,
17
- value: null,
18
- };
19
- expect(filterSentence(isNullFilter)).toEqual('Field is null');
20
- expect(filterSentence(isNotNullFilter)).toEqual('Field is not null');
21
- });
22
- it('should handle string filters', () => {
23
- const stringExactlyFilter = {
24
- name: FilterNames.StringFilter,
25
- operator: StringOperator.IsExactly,
26
- field: 'field',
27
- type: FieldTypes.String,
28
- value: 'this',
29
- };
30
- const stringNotExactlyFilter = {
31
- name: FilterNames.StringFilter,
32
- operator: StringOperator.IsNotExactly,
33
- field: 'field',
34
- type: FieldTypes.String,
35
- value: 'this',
36
- };
37
- const stringContainsFilter = {
38
- name: FilterNames.StringFilter,
39
- operator: StringOperator.Contains,
40
- field: 'field',
41
- type: FieldTypes.String,
42
- value: 'this',
43
- };
44
- expect(filterSentence(stringExactlyFilter)).toEqual('Field is exactly this');
45
- expect(filterSentence(stringNotExactlyFilter)).toEqual('Field is not exactly this');
46
- expect(filterSentence(stringContainsFilter)).toEqual('Field contains this');
47
- });
48
- it('should handle number filters', () => {
49
- const numberEqualToFilter = {
50
- name: FilterNames.NumericFilter,
51
- operator: NumberOperator.EqualTo,
52
- field: 'field',
53
- type: FieldTypes.Numeric,
54
- value: 0,
55
- };
56
- const numberNotEqualToFilter = {
57
- name: FilterNames.NumericFilter,
58
- operator: NumberOperator.NotEqualTo,
59
- field: 'field',
60
- type: FieldTypes.Numeric,
61
- value: 0,
62
- };
63
- const numberGreaterThanFilter = {
64
- name: FilterNames.NumericFilter,
65
- operator: NumberOperator.GreaterThan,
66
- field: 'field',
67
- type: FieldTypes.Numeric,
68
- value: 0,
69
- };
70
- const numberLessThanFilter = {
71
- name: FilterNames.NumericFilter,
72
- operator: NumberOperator.LessThan,
73
- field: 'field',
74
- type: FieldTypes.Numeric,
75
- value: 0,
76
- };
77
- const numberGreaterThanOrEqualToFilter = {
78
- name: FilterNames.NumericFilter,
79
- operator: NumberOperator.GreaterThanOrEqualTo,
80
- field: 'field',
81
- type: FieldTypes.Numeric,
82
- value: 0,
83
- };
84
- const numberLessThanOrEqualToFilter = {
85
- name: FilterNames.NumericFilter,
86
- operator: NumberOperator.LessThanOrEqualTo,
87
- field: 'field',
88
- type: FieldTypes.Numeric,
89
- value: 0,
90
- };
91
- expect(filterSentence(numberEqualToFilter)).toEqual('Field equal to 0');
92
- expect(filterSentence(numberNotEqualToFilter)).toEqual('Field not equal to 0');
93
- expect(filterSentence(numberGreaterThanFilter)).toEqual('Field greater than 0');
94
- expect(filterSentence(numberLessThanFilter)).toEqual('Field less than 0');
95
- expect(filterSentence(numberGreaterThanOrEqualToFilter)).toEqual('Field greater than or equal to 0');
96
- expect(filterSentence(numberLessThanOrEqualToFilter)).toEqual('Field less than or equal to 0');
97
- });
98
- it('should handle boolean filters', () => {
99
- const booleanEqualToFilter = {
100
- name: FilterNames.BooleanFilter,
101
- operator: BoolOperator.EqualTo,
102
- field: 'field',
103
- type: FieldTypes.Boolean,
104
- value: true,
105
- };
106
- const booleanNotEqualToFilter = {
107
- name: FilterNames.BooleanFilter,
108
- operator: BoolOperator.NotEqualTo,
109
- field: 'field',
110
- type: FieldTypes.Boolean,
111
- value: true,
112
- };
113
- expect(filterSentence(booleanEqualToFilter)).toEqual('Field equal to true');
114
- expect(filterSentence(booleanNotEqualToFilter)).toEqual('Field not equal to true');
115
- });
116
- it('should handle date filters', () => {
117
- const dateInTheLastFilter = {
118
- name: FilterNames.DateFilter,
119
- operator: DateOperator.InTheLast,
120
- field: 'field',
121
- type: FieldTypes.Date,
122
- value: { value: 10, unit: 'day' },
123
- };
124
- const dateInTheLastFilterSingular = {
125
- name: FilterNames.DateFilter,
126
- operator: DateOperator.InTheLast,
127
- field: 'field',
128
- type: FieldTypes.Date,
129
- value: { value: 1, unit: 'day' },
130
- };
131
- const dateInTheCurrentFilter = {
132
- name: FilterNames.DateFilter,
133
- operator: DateOperator.InTheCurrent,
134
- field: 'field',
135
- type: FieldTypes.Date,
136
- value: { value: 1, unit: 'day' },
137
- };
138
- const dateInThePreviousFilter = {
139
- name: FilterNames.DateFilter,
140
- operator: DateOperator.InThePrevious,
141
- field: 'field',
142
- type: FieldTypes.Date,
143
- value: { value: 10, unit: 'day' },
144
- };
145
- const dateInThePreviousFilterSingular = {
146
- name: FilterNames.DateFilter,
147
- operator: DateOperator.InThePrevious,
148
- field: 'field',
149
- type: FieldTypes.Date,
150
- value: { value: 1, unit: 'day' },
151
- };
152
- expect(filterSentence(dateInTheLastFilter)).toEqual('Field in the last 10 days');
153
- expect(filterSentence(dateInTheLastFilterSingular)).toEqual('Field in the last 1 day');
154
- expect(filterSentence(dateInTheCurrentFilter)).toEqual('Field in the current day');
155
- expect(filterSentence(dateInThePreviousFilter)).toEqual('Field in the previous 10 days');
156
- expect(filterSentence(dateInThePreviousFilterSingular)).toEqual('Field in the previous 1 day');
157
- });
158
- it('should handle date comparison filters', () => {
159
- const dateEqualToFilter = {
160
- name: FilterNames.DateComparisonFilter,
161
- operator: DateOperator.EqualTo,
162
- field: 'field',
163
- type: FieldTypes.Date,
164
- value: '2021-01-01',
165
- };
166
- const dateNotEqualToFilter = {
167
- name: FilterNames.DateComparisonFilter,
168
- operator: DateOperator.NotEqualTo,
169
- field: 'field',
170
- type: FieldTypes.Date,
171
- value: '2021-01-01',
172
- };
173
- const dateGreaterThanFilter = {
174
- name: FilterNames.DateComparisonFilter,
175
- operator: DateOperator.GreaterThan,
176
- field: 'field',
177
- type: FieldTypes.Date,
178
- value: '2021-01-01',
179
- };
180
- const dateLessThanFilter = {
181
- name: FilterNames.DateComparisonFilter,
182
- operator: DateOperator.LessThan,
183
- field: 'field',
184
- type: FieldTypes.Date,
185
- value: '2021-01-01',
186
- };
187
- const dateGreaterThanOrEqualToFilter = {
188
- name: FilterNames.DateComparisonFilter,
189
- operator: DateOperator.GreaterThanOrEqualTo,
190
- field: 'field',
191
- type: FieldTypes.Date,
192
- value: '2021-01-01',
193
- };
194
- const dateLessThanOrEqualToFilter = {
195
- name: FilterNames.DateComparisonFilter,
196
- operator: DateOperator.LessThanOrEqualTo,
197
- field: 'field',
198
- type: FieldTypes.Date,
199
- value: '2021-01-01',
200
- };
201
- expect(filterSentence(dateEqualToFilter)).toEqual('Field equal to 2021-01-01');
202
- expect(filterSentence(dateNotEqualToFilter)).toEqual('Field not equal to 2021-01-01');
203
- expect(filterSentence(dateGreaterThanFilter)).toEqual('Field greater than 2021-01-01');
204
- expect(filterSentence(dateLessThanFilter)).toEqual('Field less than 2021-01-01');
205
- expect(filterSentence(dateGreaterThanOrEqualToFilter)).toEqual('Field greater than or equal to 2021-01-01');
206
- expect(filterSentence(dateLessThanOrEqualToFilter)).toEqual('Field less than or equal to 2021-01-01');
207
- });
208
- it('should handle custom date filters', () => {
209
- const dateCustomFilter = {
210
- name: FilterNames.DateCustomFilter,
211
- operator: DateOperator.Custom,
212
- field: 'field',
213
- type: FieldTypes.Date,
214
- value: { startDate: '2021-01-01', endDate: '2021-12-31' },
215
- };
216
- expect(filterSentence(dateCustomFilter)).toEqual('Field custom from 2021-01-01');
217
- });
218
- it('should handle string in filters', () => {
219
- const stringIsFilter = {
220
- name: FilterNames.StringFilter,
221
- operator: StringOperator.Is,
222
- field: 'field',
223
- type: FieldTypes.String,
224
- value: ['this', 'that'],
225
- };
226
- const stringIsNotFilter = {
227
- name: FilterNames.StringFilter,
228
- operator: StringOperator.IsNot,
229
- field: 'field',
230
- type: FieldTypes.String,
231
- value: ['this', 'that'],
232
- };
233
- expect(filterSentence(stringIsFilter)).toEqual('Field is one of this, that');
234
- expect(filterSentence(stringIsNotFilter)).toEqual('Field is not one of this, that');
235
- });
236
- it('should throw an error for invalid filters', () => {
237
- const invalidFilter = {
238
- name: 'filter',
239
- operator: '=',
240
- field: 'field',
241
- type: 'string',
242
- };
243
- expect(filterSentence(invalidFilter)).toEqual('Error: filter missing value');
244
- });
245
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=queryConstructor.uspec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryConstructor.uspec.d.ts","sourceRoot":"","sources":["../../../src/utils/queryConstructor.uspec.ts"],"names":[],"mappings":""}