@sisense/sdk-data 1.14.0 → 1.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/dist/cjs/dimensional-model/filters/factory.d.ts +4 -2
- package/dist/cjs/dimensional-model/filters/factory.js +5 -3
- package/dist/cjs/dimensional-model/filters/filters.d.ts +4 -2
- package/dist/cjs/dimensional-model/filters/filters.js +5 -3
- package/dist/cjs/dimensional-model/filters/utils/condition-filter-util.js +2 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.js +5 -2
- package/dist/cjs/dimensional-model/filters/utils/filter-types-util.js +1 -1
- package/dist/cjs/package.json +12 -0
- package/dist/dimensional-model/filters/factory.d.ts +4 -2
- package/dist/dimensional-model/filters/factory.js +5 -3
- package/dist/dimensional-model/filters/filters.d.ts +4 -2
- package/dist/dimensional-model/filters/filters.js +5 -3
- package/dist/dimensional-model/filters/utils/condition-filter-util.js +2 -1
- package/dist/dimensional-model/filters/utils/filter-from-jaql-util.js +5 -2
- package/dist/dimensional-model/filters/utils/filter-types-util.js +1 -1
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/package.json +4 -9
- package/dist/cjs/dimensional-model/analytics/factory.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/analytics/factory.test.js +0 -99
- package/dist/cjs/dimensional-model/attributes.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/attributes.test.js +0 -154
- package/dist/cjs/dimensional-model/base.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/base.test.js +0 -17
- package/dist/cjs/dimensional-model/dimensions.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/dimensions.test.js +0 -84
- package/dist/cjs/dimensional-model/filters/factory.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/filters/factory.test.js +0 -366
- package/dist/cjs/dimensional-model/filters/filters.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/filters/filters.test.js +0 -241
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-code-util.test.js +0 -32
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-from-jaql-util.test.js +0 -623
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/filters/utils/filter-matcher-utils.test.js +0 -236
- package/dist/cjs/dimensional-model/measures/factory.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/measures/factory.test.js +0 -481
- package/dist/cjs/dimensional-model/measures/measures.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/measures/measures.test.js +0 -79
- package/dist/cjs/dimensional-model/simple-column-types.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/simple-column-types.test.js +0 -85
- package/dist/cjs/dimensional-model/types.test.d.ts +0 -1
- package/dist/cjs/dimensional-model/types.test.js +0 -33
- package/dist/cjs/utils.test.d.ts +0 -1
- package/dist/cjs/utils.test.js +0 -182
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
-
/* eslint-disable vitest/no-identical-title */
|
|
7
|
-
const attributes_js_1 = require("./attributes.js");
|
|
8
|
-
const types_js_1 = require("./types.js");
|
|
9
|
-
describe('Attributes jaql preparations', () => {
|
|
10
|
-
it('must prepare simple attribute jaql', () => {
|
|
11
|
-
const result = { jaql: { title: 'Brand', dim: '[Brand.Brand ID]', datatype: 'text' } };
|
|
12
|
-
const attribute = new attributes_js_1.DimensionalAttribute('Brand', '[Brand.Brand ID]');
|
|
13
|
-
const jaql = attribute.jaql();
|
|
14
|
-
expect(jaql).toStrictEqual(result);
|
|
15
|
-
});
|
|
16
|
-
it('must prepare simple level attribute jaql', () => {
|
|
17
|
-
const result = {
|
|
18
|
-
jaql: {
|
|
19
|
-
title: 'Years',
|
|
20
|
-
dim: '[Commerce.Date (Calendar)]',
|
|
21
|
-
level: 'years',
|
|
22
|
-
datatype: 'datetime',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const level = new attributes_js_1.DimensionalLevelAttribute('Years', '[Commerce.Date (Calendar)]', types_js_1.DateLevels.Years);
|
|
26
|
-
const jaql = level.jaql();
|
|
27
|
-
expect(jaql).toStrictEqual(result);
|
|
28
|
-
});
|
|
29
|
-
it('must prepare minutes level attribute jaql', () => {
|
|
30
|
-
const result = {
|
|
31
|
-
jaql: {
|
|
32
|
-
title: types_js_1.DateLevels.MinutesRoundTo30,
|
|
33
|
-
dim: '[Commerce.Date (Calendar)]',
|
|
34
|
-
dateTimeLevel: 'minutes',
|
|
35
|
-
bucket: '30',
|
|
36
|
-
datatype: 'datetime',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const level = new attributes_js_1.DimensionalLevelAttribute(types_js_1.DateLevels.MinutesRoundTo30, '[Commerce.Date (Calendar)]', types_js_1.DateLevels.MinutesRoundTo30);
|
|
40
|
-
const jaql = level.jaql();
|
|
41
|
-
expect(jaql).toStrictEqual(result);
|
|
42
|
-
});
|
|
43
|
-
it('must prepare minutes level attribute jaql', () => {
|
|
44
|
-
const result = {
|
|
45
|
-
jaql: {
|
|
46
|
-
title: types_js_1.DateLevels.AggMinutesRoundTo1,
|
|
47
|
-
dim: '[Commerce.Date (Calendar)]',
|
|
48
|
-
level: 'minutes',
|
|
49
|
-
bucket: '1',
|
|
50
|
-
datatype: 'datetime',
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
const level = new attributes_js_1.DimensionalLevelAttribute(types_js_1.DateLevels.AggMinutesRoundTo1, '[Commerce.Date (Calendar)]', types_js_1.DateLevels.AggMinutesRoundTo1);
|
|
54
|
-
const jaql = level.jaql();
|
|
55
|
-
expect(jaql).toStrictEqual(result);
|
|
56
|
-
});
|
|
57
|
-
it('must apply format during transform level attribute jaql', () => {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
const format = 'yyyy MM dd';
|
|
60
|
-
const level = new attributes_js_1.DimensionalLevelAttribute('Years', '[Commerce.Date (Calendar)]', 'Years', format);
|
|
61
|
-
const jaql = level.jaql();
|
|
62
|
-
expect((_b = (_a = jaql.format) === null || _a === void 0 ? void 0 : _a.mask) === null || _b === void 0 ? void 0 : _b.years).toEqual(format);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('createAttribute', () => {
|
|
66
|
-
it('should create attribute from json', () => {
|
|
67
|
-
const numericAttribute = (0, attributes_js_1.createAttribute)({
|
|
68
|
-
name: 'BrandID',
|
|
69
|
-
type: 'numeric-attribute',
|
|
70
|
-
expression: '[Commerce.Brand ID]',
|
|
71
|
-
description: 'Fortune999 Brands',
|
|
72
|
-
});
|
|
73
|
-
expect(numericAttribute).toBeInstanceOf(attributes_js_1.DimensionalAttribute);
|
|
74
|
-
expect(numericAttribute.name).toBe('BrandID');
|
|
75
|
-
expect(numericAttribute.expression).toBe('[Commerce.Brand ID]');
|
|
76
|
-
expect(numericAttribute.type).toBe('numeric-attribute');
|
|
77
|
-
expect(numericAttribute.description).toBe('Fortune999 Brands');
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('translateJaqlToGranularity', () => {
|
|
81
|
-
it('should handle unsupported dateTimeLevel', () => {
|
|
82
|
-
const json = { dateTimeLevel: 'unsupported', bucket: '15' };
|
|
83
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe('unsupported');
|
|
84
|
-
});
|
|
85
|
-
it('should handle unsupported level', () => {
|
|
86
|
-
const json = { level: 'unsupported' };
|
|
87
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe('unsupported');
|
|
88
|
-
});
|
|
89
|
-
it('should translate years level', () => {
|
|
90
|
-
const json = { level: 'years' };
|
|
91
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.Years);
|
|
92
|
-
});
|
|
93
|
-
it('should translate quarters level', () => {
|
|
94
|
-
const json = { level: 'quarters' };
|
|
95
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.Quarters);
|
|
96
|
-
});
|
|
97
|
-
it('should translate months level', () => {
|
|
98
|
-
const json = { level: 'months' };
|
|
99
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.Months);
|
|
100
|
-
});
|
|
101
|
-
it('should translate weeks level', () => {
|
|
102
|
-
const json = { level: 'weeks' };
|
|
103
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.Weeks);
|
|
104
|
-
});
|
|
105
|
-
it('should translate days level', () => {
|
|
106
|
-
const json = { level: 'days' };
|
|
107
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.Days);
|
|
108
|
-
});
|
|
109
|
-
it('should translate aggregated minutes level with 60 bucket', () => {
|
|
110
|
-
const json = { level: 'minutes', bucket: '60' };
|
|
111
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.AggHours);
|
|
112
|
-
});
|
|
113
|
-
it('should translate aggregated minutes level with 30 bucket', () => {
|
|
114
|
-
const json = { level: 'minutes', bucket: '30' };
|
|
115
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.AggMinutesRoundTo30);
|
|
116
|
-
});
|
|
117
|
-
it('should translate aggregated minutes level with 15 bucket', () => {
|
|
118
|
-
const json = { level: 'minutes', bucket: '15' };
|
|
119
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.AggMinutesRoundTo15);
|
|
120
|
-
});
|
|
121
|
-
it('should translate aggregated minutes level with 1 bucket', () => {
|
|
122
|
-
const json = { level: 'minutes', bucket: '1' };
|
|
123
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.AggMinutesRoundTo1);
|
|
124
|
-
});
|
|
125
|
-
it('should translate minutes level with 60 bucket', () => {
|
|
126
|
-
const json = { dateTimeLevel: 'minutes', bucket: '60' };
|
|
127
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.Hours);
|
|
128
|
-
});
|
|
129
|
-
it('should translate minutes level with 30 bucket', () => {
|
|
130
|
-
const json = { dateTimeLevel: 'minutes', bucket: '30' };
|
|
131
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.MinutesRoundTo30);
|
|
132
|
-
});
|
|
133
|
-
it('should translate minutes level with 15 bucket', () => {
|
|
134
|
-
const json = { dateTimeLevel: 'minutes', bucket: '15' };
|
|
135
|
-
expect(attributes_js_1.DimensionalLevelAttribute.translateJaqlToGranularity(json)).toBe(types_js_1.DateLevels.MinutesRoundTo15);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe('getDefaultFormatForGranularity', () => {
|
|
139
|
-
it('should return default format', () => {
|
|
140
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.Years)).toBe('yyyy');
|
|
141
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.Quarters)).toBe('Q yyyy');
|
|
142
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.Months)).toBe('yyyy-MM');
|
|
143
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.Weeks)).toBe('ww yyyy');
|
|
144
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.Days)).toBe('yyyy-MM-dd');
|
|
145
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.Hours)).toBe('yyyy-MM-dd HH:mm');
|
|
146
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.MinutesRoundTo30)).toBe('yyyy-MM-dd HH:mm');
|
|
147
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.MinutesRoundTo15)).toBe('yyyy-MM-dd HH:mm');
|
|
148
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.AggHours)).toBe('HH:mm');
|
|
149
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.AggMinutesRoundTo30)).toBe('HH:mm');
|
|
150
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.AggMinutesRoundTo15)).toBe('HH:mm');
|
|
151
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity(types_js_1.DateLevels.AggMinutesRoundTo1)).toBe('HH:mm');
|
|
152
|
-
expect(attributes_js_1.DimensionalLevelAttribute.getDefaultFormatForGranularity('unrecognized-level')).toBe('');
|
|
153
|
-
});
|
|
154
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const base_js_1 = require("./base.js");
|
|
4
|
-
describe('normalizeName', () => {
|
|
5
|
-
it('should remove invalid characters', () => {
|
|
6
|
-
expect((0, base_js_1.normalizeName)('my!name!is!awesome!')).toBe('mynameisawesome');
|
|
7
|
-
});
|
|
8
|
-
it('should prefix name with underscore if it starts with a non-alphabetical character', () => {
|
|
9
|
-
expect((0, base_js_1.normalizeName)('123name')).toBe('_123name');
|
|
10
|
-
});
|
|
11
|
-
it('should keep the name unchanged if it has no invalid characters and starts with an alphabetical character', () => {
|
|
12
|
-
expect((0, base_js_1.normalizeName)('validName')).toBe('validName');
|
|
13
|
-
});
|
|
14
|
-
it('should keep the name unchanged if it has no invalid characters and starts with an underscore', () => {
|
|
15
|
-
expect((0, base_js_1.normalizeName)('_validName')).toBe('_validName');
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
-
const attributes_js_1 = require("./attributes.js");
|
|
7
|
-
const dimensions_js_1 = require("./dimensions.js");
|
|
8
|
-
const types_js_1 = require("./types.js");
|
|
9
|
-
describe('Dimension jaql preparations', () => {
|
|
10
|
-
it('must prepare simple text dimension jaql', () => {
|
|
11
|
-
const result = { jaql: { title: 'Brand', dim: '[Brand.Brand]', datatype: 'text' } };
|
|
12
|
-
const dimension = new dimensions_js_1.DimensionalDimension('Brand', '[Brand.Brand]', [new attributes_js_1.DimensionalAttribute('Brand', '[Brand.Brand]')], [], 'textdimension');
|
|
13
|
-
const jaql = dimension.jaql();
|
|
14
|
-
expect(jaql).toStrictEqual(result);
|
|
15
|
-
});
|
|
16
|
-
it('must prepare simple text dimension with default attribute jaql', () => {
|
|
17
|
-
const result = { jaql: { title: 'Brand', dim: '[Brand.Brand]', datatype: 'text' } };
|
|
18
|
-
const attribute = new attributes_js_1.DimensionalAttribute('Brand', '[Brand.Brand]');
|
|
19
|
-
const dimension = new dimensions_js_1.DimensionalDimension('Brand', '[Brand.Brand]', [attribute], [], 'textdimension');
|
|
20
|
-
dimension.defaultAttribute = attribute;
|
|
21
|
-
const jaql = dimension.jaql();
|
|
22
|
-
expect(jaql).toStrictEqual(result);
|
|
23
|
-
});
|
|
24
|
-
it('must prepare simple text dimension with nested dimension jaql', () => {
|
|
25
|
-
const result = { jaql: { title: 'Brand', dim: '[Brand.Brand]', datatype: 'text' } };
|
|
26
|
-
const dimension = new dimensions_js_1.DimensionalDimension('Brand', '', [new attributes_js_1.DimensionalAttribute('Brand', '')], [
|
|
27
|
-
new dimensions_js_1.DimensionalDimension('Brand', '[Brand.Brand]', [new attributes_js_1.DimensionalAttribute('Brand', '[Brand.Brand]')], [], 'textdimension'),
|
|
28
|
-
], 'textdimension');
|
|
29
|
-
const jaql = dimension.jaql();
|
|
30
|
-
expect(jaql).toStrictEqual(result);
|
|
31
|
-
});
|
|
32
|
-
it('must prepare date dimension jaql', () => {
|
|
33
|
-
const result = {
|
|
34
|
-
jaql: {
|
|
35
|
-
title: 'Date',
|
|
36
|
-
dim: '[Commerce.Date (Calendar)]',
|
|
37
|
-
level: 'years',
|
|
38
|
-
datatype: 'datetime',
|
|
39
|
-
},
|
|
40
|
-
format: { mask: { years: 'yyyy' } },
|
|
41
|
-
};
|
|
42
|
-
const dimension = new dimensions_js_1.DimensionalDateDimension('Date', '[Commerce.Date (Calendar)]');
|
|
43
|
-
const jaql = dimension.jaql();
|
|
44
|
-
expect(jaql).toStrictEqual(result);
|
|
45
|
-
});
|
|
46
|
-
it('must prepare jaql for date dimension with "seconds" level', () => {
|
|
47
|
-
const result = {
|
|
48
|
-
jaql: {
|
|
49
|
-
title: 'Seconds',
|
|
50
|
-
dim: '[Commerce.Date (Calendar)]',
|
|
51
|
-
bucket: '0',
|
|
52
|
-
dateTimeLevel: 'seconds',
|
|
53
|
-
datatype: 'datetime',
|
|
54
|
-
},
|
|
55
|
-
format: { mask: { seconds: 'yyyy-MM-dd HH:mm:ss' } },
|
|
56
|
-
};
|
|
57
|
-
const dimension = new dimensions_js_1.DimensionalDateDimension('Date', '[Commerce.Date (Calendar)]');
|
|
58
|
-
const jaql = dimension.Seconds.jaql();
|
|
59
|
-
expect(jaql).toStrictEqual(result);
|
|
60
|
-
});
|
|
61
|
-
it('must prepare jaql for date dimension with "minutes" level', () => {
|
|
62
|
-
const result = {
|
|
63
|
-
jaql: {
|
|
64
|
-
title: 'Minutes',
|
|
65
|
-
dim: '[Commerce.Date (Calendar)]',
|
|
66
|
-
bucket: '1',
|
|
67
|
-
dateTimeLevel: 'minutes',
|
|
68
|
-
datatype: 'datetime',
|
|
69
|
-
},
|
|
70
|
-
format: { mask: { minutes: 'yyyy-MM-dd HH:mm' } },
|
|
71
|
-
};
|
|
72
|
-
const dimension = new dimensions_js_1.DimensionalDateDimension('Date', '[Commerce.Date (Calendar)]');
|
|
73
|
-
const jaql = dimension.Minutes.jaql();
|
|
74
|
-
expect(jaql).toStrictEqual(result);
|
|
75
|
-
});
|
|
76
|
-
it('must handle sort', () => {
|
|
77
|
-
const dimensionAscSort = new dimensions_js_1.DimensionalDimension('Brand', '[Brand.Brand]', [new attributes_js_1.DimensionalAttribute('Brand', '[Brand.Brand]')], [], 'textdimension', '', types_js_1.Sort.Ascending);
|
|
78
|
-
const dimensionDescSort = new dimensions_js_1.DimensionalDimension('Brand', '[Brand.Brand]', [new attributes_js_1.DimensionalAttribute('Brand', '[Brand.Brand]')], [], 'textdimension', '', types_js_1.Sort.Descending);
|
|
79
|
-
const jaqlAscSort = dimensionAscSort.jaql();
|
|
80
|
-
const jaqlDescSort = dimensionDescSort.jaql();
|
|
81
|
-
expect(jaqlAscSort.jaql.sort).toBe('asc');
|
|
82
|
-
expect(jaqlDescSort.jaql.sort).toBe('desc');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
27
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
28
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
29
|
-
const index_js_1 = require("../../index.js");
|
|
30
|
-
const dimensions_js_1 = require("../dimensions.js");
|
|
31
|
-
const filterFactory = __importStar(require("./factory.js"));
|
|
32
|
-
const filters_js_1 = require("./filters.js");
|
|
33
|
-
const TextDim = (0, dimensions_js_1.createDimension)({
|
|
34
|
-
name: 'text',
|
|
35
|
-
type: 'textdimension',
|
|
36
|
-
expression: '[Text]',
|
|
37
|
-
});
|
|
38
|
-
const NumDim = (0, dimensions_js_1.createDimension)({
|
|
39
|
-
name: 'num',
|
|
40
|
-
type: 'numericdimension',
|
|
41
|
-
expression: '[Num]',
|
|
42
|
-
});
|
|
43
|
-
const DateDim = (0, dimensions_js_1.createDateDimension)({
|
|
44
|
-
name: 'date',
|
|
45
|
-
expression: '[Date]',
|
|
46
|
-
});
|
|
47
|
-
const filter1 = new filters_js_1.MembersFilter(TextDim, []);
|
|
48
|
-
const filter2 = new filters_js_1.MembersFilter(NumDim, []);
|
|
49
|
-
describe('filterFactory', () => {
|
|
50
|
-
test('filterFactory.union()', () => {
|
|
51
|
-
const f = filterFactory.union([filter1, filter2]);
|
|
52
|
-
expect(f).toBeInstanceOf(filters_js_1.LogicalAttributeFilter);
|
|
53
|
-
expect(f).toHaveProperty('operator', filters_js_1.LogicalOperators.Union);
|
|
54
|
-
expect(f).toHaveProperty('filters', [filter1, filter2]);
|
|
55
|
-
});
|
|
56
|
-
test('filterFactory.intersection()', () => {
|
|
57
|
-
const f = filterFactory.intersection([filter1, filter2]);
|
|
58
|
-
expect(f).toBeInstanceOf(filters_js_1.LogicalAttributeFilter);
|
|
59
|
-
expect(f).toHaveProperty('operator', filters_js_1.LogicalOperators.Intersection);
|
|
60
|
-
expect(f).toHaveProperty('filters', [filter1, filter2]);
|
|
61
|
-
});
|
|
62
|
-
test('filterFactory.exclude()', () => {
|
|
63
|
-
const f = filterFactory.exclude(filter1);
|
|
64
|
-
expect(f).toBeInstanceOf(filters_js_1.ExcludeFilter);
|
|
65
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
66
|
-
expect(f).toHaveProperty('filter', filter1);
|
|
67
|
-
});
|
|
68
|
-
test('filterFactory.doesntContain()', () => {
|
|
69
|
-
const f = filterFactory.doesntContain(TextDim, 'mem');
|
|
70
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
71
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
72
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntContain);
|
|
73
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
74
|
-
});
|
|
75
|
-
test('filterFactory.doesntEndWith()', () => {
|
|
76
|
-
const f = filterFactory.doesntEndWith(TextDim, 'mem');
|
|
77
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
78
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
79
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntEndWith);
|
|
80
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
81
|
-
});
|
|
82
|
-
test('filterFactory.doesntStartWith()', () => {
|
|
83
|
-
const f = filterFactory.doesntStartWith(TextDim, 'mem');
|
|
84
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
85
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
86
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntStartWith);
|
|
87
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
88
|
-
});
|
|
89
|
-
test('filterFactory.contains()', () => {
|
|
90
|
-
const f = filterFactory.contains(TextDim, 'mem');
|
|
91
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
92
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
93
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.Contains);
|
|
94
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
95
|
-
});
|
|
96
|
-
test('filterFactory.endsWith()', () => {
|
|
97
|
-
const f = filterFactory.endsWith(TextDim, 'mem');
|
|
98
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
99
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
100
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.EndsWith);
|
|
101
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
102
|
-
});
|
|
103
|
-
test('filterFactory.startsWith()', () => {
|
|
104
|
-
const f = filterFactory.startsWith(TextDim, 'mem');
|
|
105
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
106
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
107
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.StartsWith);
|
|
108
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
109
|
-
});
|
|
110
|
-
test('filterFactory.like()', () => {
|
|
111
|
-
const f = filterFactory.like(TextDim, '%mem%');
|
|
112
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
113
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
114
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.Like);
|
|
115
|
-
expect(f).toHaveProperty('valueA', '%mem%');
|
|
116
|
-
});
|
|
117
|
-
test('filterFactory.doesntEqual() with string arg', () => {
|
|
118
|
-
const f = filterFactory.doesntEqual(TextDim, 'mem');
|
|
119
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
120
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
121
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.DoesntEqual);
|
|
122
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
123
|
-
});
|
|
124
|
-
test('filterFactory.doesntEqual() with numeric arg', () => {
|
|
125
|
-
const f = filterFactory.doesntEqual(NumDim, 5);
|
|
126
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
127
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
128
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.DoesntEqual);
|
|
129
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
130
|
-
});
|
|
131
|
-
test('filterFactory.equals() with string arg', () => {
|
|
132
|
-
const f = filterFactory.equals(TextDim, 'mem');
|
|
133
|
-
expect(f).toBeInstanceOf(filters_js_1.TextFilter);
|
|
134
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
135
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.TextOperators.Equals);
|
|
136
|
-
expect(f).toHaveProperty('valueA', 'mem');
|
|
137
|
-
});
|
|
138
|
-
test('filterFactory.equals() with numeric arg', () => {
|
|
139
|
-
const f = filterFactory.equals(NumDim, 5);
|
|
140
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
141
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
142
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.Equals);
|
|
143
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
144
|
-
});
|
|
145
|
-
test('filterFactory.greaterThan()', () => {
|
|
146
|
-
const f = filterFactory.greaterThan(NumDim, 5);
|
|
147
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
148
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
149
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.FromNotEqual);
|
|
150
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
151
|
-
});
|
|
152
|
-
test('filterFactory.greaterThanOrEqual()', () => {
|
|
153
|
-
const f = filterFactory.greaterThanOrEqual(NumDim, 5);
|
|
154
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
155
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
156
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
|
|
157
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
158
|
-
});
|
|
159
|
-
test('filterFactory.lessThan()', () => {
|
|
160
|
-
const f = filterFactory.lessThan(NumDim, 5);
|
|
161
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
162
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
163
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.ToNotEqual);
|
|
164
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
165
|
-
});
|
|
166
|
-
test('filterFactory.lessThanOrEqual()', () => {
|
|
167
|
-
const f = filterFactory.lessThanOrEqual(NumDim, 5);
|
|
168
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
169
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
170
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.To);
|
|
171
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
172
|
-
});
|
|
173
|
-
test('filterFactory.between()', () => {
|
|
174
|
-
const f = filterFactory.between(NumDim, 3, 7);
|
|
175
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
176
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
177
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
|
|
178
|
-
expect(f).toHaveProperty('valueA', 3);
|
|
179
|
-
expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.To);
|
|
180
|
-
expect(f).toHaveProperty('valueB', 7);
|
|
181
|
-
});
|
|
182
|
-
test('filterFactory.betweenNotEqual()', () => {
|
|
183
|
-
const f = filterFactory.betweenNotEqual(NumDim, 3, 7);
|
|
184
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
185
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
186
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.FromNotEqual);
|
|
187
|
-
expect(f).toHaveProperty('valueA', 3);
|
|
188
|
-
expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.ToNotEqual);
|
|
189
|
-
expect(f).toHaveProperty('valueB', 7);
|
|
190
|
-
});
|
|
191
|
-
test('filterFactory.numeric()', () => {
|
|
192
|
-
const f = filterFactory.numeric(NumDim, filters_js_1.NumericOperators.Equals, 5);
|
|
193
|
-
expect(f).toBeInstanceOf(filters_js_1.NumericFilter);
|
|
194
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
195
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.Equals);
|
|
196
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
197
|
-
});
|
|
198
|
-
test('filterFactory.members()', () => {
|
|
199
|
-
const f = filterFactory.members(TextDim, ['mem1', 'mem2']);
|
|
200
|
-
expect(f).toBeInstanceOf(filters_js_1.MembersFilter);
|
|
201
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
202
|
-
expect(f).toHaveProperty('members', ['mem1', 'mem2']);
|
|
203
|
-
});
|
|
204
|
-
test('filterFactory.dateFrom()', () => {
|
|
205
|
-
const f = filterFactory.dateFrom(DateDim.Years, '2020-02-02T00:00:00Z');
|
|
206
|
-
expect(f).toBeInstanceOf(filters_js_1.DateRangeFilter);
|
|
207
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
208
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.DateOperators.From);
|
|
209
|
-
expect(f).toHaveProperty('valueA', '2020-02-02T00:00:00Z');
|
|
210
|
-
});
|
|
211
|
-
test('filterFactory.dateTo()', () => {
|
|
212
|
-
const f = filterFactory.dateTo(DateDim.Years, '2020-02-02T00:00:00Z');
|
|
213
|
-
expect(f).toBeInstanceOf(filters_js_1.DateRangeFilter);
|
|
214
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
215
|
-
expect(f).toHaveProperty('operatorB', filters_js_1.DateOperators.To);
|
|
216
|
-
expect(f).toHaveProperty('valueB', '2020-02-02T00:00:00Z');
|
|
217
|
-
});
|
|
218
|
-
test('filterFactory.dateRange()', () => {
|
|
219
|
-
const f = filterFactory.dateRange(DateDim.Years, '2020-02-02T00:00:00Z', '2021-02-02T00:00:00Z');
|
|
220
|
-
expect(f).toBeInstanceOf(filters_js_1.DateRangeFilter);
|
|
221
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
222
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.DateOperators.From);
|
|
223
|
-
expect(f).toHaveProperty('valueA', '2020-02-02T00:00:00Z');
|
|
224
|
-
expect(f).toHaveProperty('operatorB', filters_js_1.DateOperators.To);
|
|
225
|
-
expect(f).toHaveProperty('valueB', '2021-02-02T00:00:00Z');
|
|
226
|
-
});
|
|
227
|
-
test('filterFactory.dateRelative()', () => {
|
|
228
|
-
const f = filterFactory.dateRelative(DateDim.Years, 0, 1);
|
|
229
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
230
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
231
|
-
expect(f).toHaveProperty('offset', 0);
|
|
232
|
-
expect(f).toHaveProperty('count', 1);
|
|
233
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Next);
|
|
234
|
-
});
|
|
235
|
-
test('filterFactory.dateRelativeFrom()', () => {
|
|
236
|
-
const f = filterFactory.dateRelativeFrom(DateDim.Years, 0, 1);
|
|
237
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
238
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
239
|
-
expect(f).toHaveProperty('offset', 0);
|
|
240
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Next);
|
|
241
|
-
});
|
|
242
|
-
test('filterFactory.dateRelativeTo()', () => {
|
|
243
|
-
const f = filterFactory.dateRelativeTo(DateDim.Years, 0, 1);
|
|
244
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
245
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
246
|
-
expect(f).toHaveProperty('offset', 0);
|
|
247
|
-
expect(f).toHaveProperty('count', 1);
|
|
248
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
|
|
249
|
-
});
|
|
250
|
-
test('filterFactory.thisYear()', () => {
|
|
251
|
-
const f = filterFactory.thisYear(DateDim);
|
|
252
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
253
|
-
expect(f).toHaveProperty('attribute', DateDim.Years);
|
|
254
|
-
expect(f).toHaveProperty('offset', 0);
|
|
255
|
-
expect(f).toHaveProperty('count', 1);
|
|
256
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
|
|
257
|
-
});
|
|
258
|
-
test('filterFactory.thisMonth()', () => {
|
|
259
|
-
const f = filterFactory.thisMonth(DateDim);
|
|
260
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
261
|
-
expect(f).toHaveProperty('attribute', DateDim.Months);
|
|
262
|
-
expect(f).toHaveProperty('offset', 0);
|
|
263
|
-
expect(f).toHaveProperty('count', 1);
|
|
264
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
|
|
265
|
-
});
|
|
266
|
-
test('filterFactory.thisQuarter()', () => {
|
|
267
|
-
const f = filterFactory.thisQuarter(DateDim);
|
|
268
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
269
|
-
expect(f).toHaveProperty('attribute', DateDim.Quarters);
|
|
270
|
-
expect(f).toHaveProperty('offset', 0);
|
|
271
|
-
expect(f).toHaveProperty('count', 1);
|
|
272
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
|
|
273
|
-
});
|
|
274
|
-
test('filterFactory.today()', () => {
|
|
275
|
-
const f = filterFactory.today(DateDim);
|
|
276
|
-
expect(f).toBeInstanceOf(filters_js_1.RelativeDateFilter);
|
|
277
|
-
expect(f).toHaveProperty('attribute', DateDim.Days);
|
|
278
|
-
expect(f).toHaveProperty('offset', 0);
|
|
279
|
-
expect(f).toHaveProperty('count', 1);
|
|
280
|
-
expect(f).toHaveProperty('operator', filters_js_1.DateOperators.Last);
|
|
281
|
-
});
|
|
282
|
-
test('filterFactory.measureBase()', () => {
|
|
283
|
-
const f = filterFactory.measureBase(NumDim, index_js_1.measureFactory.sum(NumDim), filters_js_1.NumericOperators.From, 5);
|
|
284
|
-
expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
|
|
285
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
286
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
287
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
|
|
288
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
289
|
-
});
|
|
290
|
-
test('filterFactory.measureGreaterThanOrEqual()', () => {
|
|
291
|
-
const f = filterFactory.measureGreaterThanOrEqual(index_js_1.measureFactory.sum(NumDim), 5);
|
|
292
|
-
expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
|
|
293
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
294
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
295
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
|
|
296
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
297
|
-
});
|
|
298
|
-
test('filterFactory.measureLessThanOrEqual()', () => {
|
|
299
|
-
const f = filterFactory.measureLessThanOrEqual(index_js_1.measureFactory.sum(NumDim), 5);
|
|
300
|
-
expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
|
|
301
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
302
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
303
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.To);
|
|
304
|
-
expect(f).toHaveProperty('valueA', 5);
|
|
305
|
-
});
|
|
306
|
-
test('filterFactory.measureBetween()', () => {
|
|
307
|
-
const f = filterFactory.measureBetween(index_js_1.measureFactory.sum(NumDim), 3, 7);
|
|
308
|
-
expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
|
|
309
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
310
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
311
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.From);
|
|
312
|
-
expect(f).toHaveProperty('valueA', 3);
|
|
313
|
-
expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.To);
|
|
314
|
-
expect(f).toHaveProperty('valueB', 7);
|
|
315
|
-
});
|
|
316
|
-
test('filterFactory.measureBetweenNotEqual()', () => {
|
|
317
|
-
const f = filterFactory.measureBetweenNotEqual(index_js_1.measureFactory.sum(NumDim), 3, 7);
|
|
318
|
-
expect(f).toBeInstanceOf(filters_js_1.MeasureFilter);
|
|
319
|
-
expect(f).toHaveProperty('attribute', NumDim);
|
|
320
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
321
|
-
expect(f).toHaveProperty('operatorA', filters_js_1.NumericOperators.FromNotEqual);
|
|
322
|
-
expect(f).toHaveProperty('valueA', 3);
|
|
323
|
-
expect(f).toHaveProperty('operatorB', filters_js_1.NumericOperators.ToNotEqual);
|
|
324
|
-
expect(f).toHaveProperty('valueB', 7);
|
|
325
|
-
});
|
|
326
|
-
test('filterFactory.topRanking()', () => {
|
|
327
|
-
const f = filterFactory.topRanking(TextDim, index_js_1.measureFactory.sum(NumDim), 3);
|
|
328
|
-
expect(f).toBeInstanceOf(filters_js_1.RankingFilter);
|
|
329
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
330
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
331
|
-
expect(f).toHaveProperty('operator', filters_js_1.RankingOperators.Top);
|
|
332
|
-
expect(f).toHaveProperty('count', 3);
|
|
333
|
-
});
|
|
334
|
-
test('filterFactory.bottomRanking()', () => {
|
|
335
|
-
const f = filterFactory.bottomRanking(TextDim, index_js_1.measureFactory.sum(NumDim), 3);
|
|
336
|
-
expect(f).toBeInstanceOf(filters_js_1.RankingFilter);
|
|
337
|
-
expect(f).toHaveProperty('attribute', TextDim);
|
|
338
|
-
expect(f).toHaveProperty('measure', index_js_1.measureFactory.sum(NumDim));
|
|
339
|
-
expect(f).toHaveProperty('operator', filters_js_1.RankingOperators.Bottom);
|
|
340
|
-
expect(f).toHaveProperty('count', 3);
|
|
341
|
-
});
|
|
342
|
-
test('filterFactory.logic.and()', () => {
|
|
343
|
-
const f = filterFactory.logic.and(filter1, filter2);
|
|
344
|
-
expect(f).toHaveProperty('operator', 'AND');
|
|
345
|
-
expect(f).toHaveProperty('left', filter1);
|
|
346
|
-
expect(f).toHaveProperty('right', filter2);
|
|
347
|
-
});
|
|
348
|
-
test('filterFactory.logic.and() with array', () => {
|
|
349
|
-
const f = filterFactory.logic.and([filter1, filter2], filter2);
|
|
350
|
-
expect(f).toHaveProperty('operator', 'AND');
|
|
351
|
-
expect(f).toHaveProperty('left', { operator: 'AND', left: filter1, right: filter2 });
|
|
352
|
-
expect(f).toHaveProperty('right', filter2);
|
|
353
|
-
});
|
|
354
|
-
test('filterFactory.logic.or()', () => {
|
|
355
|
-
const f = filterFactory.logic.or(filter1, filter2);
|
|
356
|
-
expect(f).toHaveProperty('operator', 'OR');
|
|
357
|
-
expect(f).toHaveProperty('left', filter1);
|
|
358
|
-
expect(f).toHaveProperty('right', filter2);
|
|
359
|
-
});
|
|
360
|
-
test('filterFactory.logic.or() with array', () => {
|
|
361
|
-
const f = filterFactory.logic.or(filter1, [filter1, filter2]);
|
|
362
|
-
expect(f).toHaveProperty('operator', 'OR');
|
|
363
|
-
expect(f).toHaveProperty('left', filter1);
|
|
364
|
-
expect(f).toHaveProperty('right', { operator: 'AND', left: filter1, right: filter2 });
|
|
365
|
-
});
|
|
366
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|