@qrvey/utils 1.3.0-8 → 1.3.0-9

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.
@@ -10,6 +10,8 @@ const isEmpty_1 = require("../../../general/mix/isEmpty");
10
10
  * @returns A new filter data with the filtered filters by columns
11
11
  */
12
12
  function getFiltersByDatasetsColumns(data, datasets = []) {
13
+ if ((0, isEmpty_1.isEmpty)(data) || (0, isEmpty_1.isEmpty)(data.scopes))
14
+ return;
13
15
  return Object.assign(Object.assign({}, data), { scopes: data.scopes.map(scope => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map(filterDataset => {
14
16
  const dataset = datasets.find(data => data.qrveyid === filterDataset.qrveyid);
15
17
  if (!(0, isEmpty_1.isEmpty)(dataset)) {
@@ -7,6 +7,8 @@ import { isEmpty } from "../../../general/mix/isEmpty";
7
7
  * @returns A new filter data with the filtered filters by columns
8
8
  */
9
9
  export function getFiltersByDatasetsColumns(data, datasets = []) {
10
+ if (isEmpty(data) || isEmpty(data.scopes))
11
+ return;
10
12
  return Object.assign(Object.assign({}, data), { scopes: data.scopes.map(scope => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map(filterDataset => {
11
13
  const dataset = datasets.find(data => data.qrveyid === filterDataset.qrveyid);
12
14
  if (!isEmpty(dataset)) {
package/jest.config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- preset: 'ts-jest',
2
+ // preset: 'ts-jest',
3
3
  testEnvironment: 'node',
4
4
  verbose: true,
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.3.0-8",
3
+ "version": "1.3.0-9",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -11,6 +11,7 @@
11
11
  "compodoc:server": "./node_modules/.bin/compodoc -p ./tsconfig.doc.json -s --port=4400",
12
12
  "lint": "eslint src --quiet --exit-on-fatal-error --ext .ts,.js",
13
13
  "lint-dev": "eslint src --debug --ext .ts,.tsx",
14
+ "pipeline": "npm run build-clean && npm run lint && npm run test",
14
15
  "publishing-old": "node ./scripts/prepare-publish && np",
15
16
  "publishing-prerelease-old": "node ./scripts/prepare-publish && np --any-branch --tag=$npm_config_tag",
16
17
  "publishing-beta-1": "node ./scripts/publishing --np-new-version=$npm_config_np_new_version --np-any-branch=$npm_config_np_any_branch --np-tag=$npm_config_np_tag",
@@ -22,13 +23,13 @@
22
23
  "license": "MIT",
23
24
  "devDependencies": {
24
25
  "@compodoc/compodoc": "1.1.19",
25
- "@types/jest": "27.5.0",
26
+ "@types/jest": "27.5.1",
26
27
  "@typescript-eslint/eslint-plugin": "5.22.0",
27
28
  "@typescript-eslint/parser": "5.22.0",
28
29
  "eslint": "8.14.0",
29
- "jest": "27.5.1",
30
+ "jest": "28.1.0",
30
31
  "np": "7.6.1",
31
- "ts-jest": "27.1.4",
32
+ "ts-jest": "28.0.2",
32
33
  "typedoc": "0.22.15",
33
34
  "typescript": "4.6.4"
34
35
  },
@@ -10,6 +10,8 @@ import { IFUData } from "../../interfaces/ui/IFUData";
10
10
  * @returns A new filter data with the filtered filters by columns
11
11
  */
12
12
  export function getFiltersByDatasetsColumns(data: IFUData, datasets: IDataset[] = []): IFUData {
13
+ if (isEmpty(data) || isEmpty(data.scopes)) return;
14
+
13
15
  return {
14
16
  ...data,
15
17
  scopes: data.scopes.map(scope => ({
@@ -0,0 +1,259 @@
1
+ // import { isTokenLabel } from '../../src/tokens/isTokenLabel';
2
+
3
+ // describe('Testing undefined argument', function () {
4
+ // test('no argument passed', function () {
5
+ // const validation: boolean = isTokenLabel();
6
+ // expect(validation).toBeFalsy();
7
+ // });
8
+
9
+ // test('Undefined argument', function () {
10
+ // const validation: boolean = isTokenLabel(undefined);
11
+ // expect(validation).toBeFalsy();
12
+ // });
13
+
14
+ // test('Null argument', function () {
15
+ // const validation: boolean = isTokenLabel(null);
16
+ // expect(validation).toBeFalsy();
17
+ // });
18
+ // });
19
+
20
+ // describe('Testing no-string arguments', function () {
21
+ // const variable1: any = 1;
22
+ // const variable2: any = false;
23
+ // const variable3: any = new Date();
24
+ // const variable4: any = { const1: 'Hello', const2: 'World'};
25
+ // const variable5: any = ['Hello', 'World'];
26
+
27
+ // test('Numeric variable', function () {
28
+ // const validation: boolean = isTokenLabel(variable1);
29
+ // expect(validation).toBeFalsy();
30
+ // });
31
+
32
+ // test('Boolean variable', function () {
33
+ // const validation: boolean = isTokenLabel(variable2);
34
+ // expect(validation).toBeFalsy();
35
+ // });
36
+
37
+ // test('Date object variable', function () {
38
+ // const validation: boolean = isTokenLabel(variable3);
39
+ // expect(validation).toBeFalsy();
40
+ // });
41
+
42
+ // test('Object variable', function () {
43
+ // const validation: boolean = isTokenLabel(variable4);
44
+ // expect(validation).toBeFalsy();
45
+ // });
46
+
47
+ // test('Array variable', function () {
48
+ // const validation: boolean = isTokenLabel(variable5);
49
+ // expect(validation).toBeFalsy();
50
+ // });
51
+ // });
52
+
53
+ // describe('Testing invalid string argument', function () {
54
+ // const variable1: string = '';
55
+ // const variable2: string = 'Hello World';
56
+ // const variable3: string = '{}';
57
+ // const variable4: string = '{{}}';
58
+ // const variable5: string = '{{ }}';
59
+ // const variable6: string = '{{ Hello }}';
60
+ // const variable7: string = '{{Hello}';
61
+ // const variable8: string = '{{Hello}}{{World}}';
62
+ // const variable9: string = '{Hello}';
63
+
64
+ // test('Empty string', function () {
65
+ // const validation: boolean = isTokenLabel(variable1);
66
+ // expect(validation).toBeFalsy();
67
+ // });
68
+
69
+ // test('Non-empty and regular string', function () {
70
+ // const validation: boolean = isTokenLabel(variable2);
71
+ // expect(validation).toBeFalsy();
72
+ // });
73
+
74
+ // test('Single curly brackets and empty label', function () {
75
+ // const validation: boolean = isTokenLabel(variable3);
76
+ // expect(validation).toBeFalsy();
77
+ // });
78
+
79
+ // test('Double curly brackets and empty label', function () {
80
+ // const validation: boolean = isTokenLabel(variable4);
81
+ // expect(validation).toBeFalsy();
82
+ // });
83
+
84
+ // test('Double curly brackets and space between them', function () {
85
+ // const validation: boolean = isTokenLabel(variable5);
86
+ // expect(validation).toBeFalsy();
87
+ // });
88
+
89
+ // test('Double curly brackets and non-empty label with space between them', function () {
90
+ // const validation: boolean = isTokenLabel(variable6);
91
+ // expect(validation).toBeFalsy();
92
+ // });
93
+
94
+ // test('Double left and single right curly brackets and non-empty label', function () {
95
+ // const validation: boolean = isTokenLabel(variable7);
96
+ // expect(validation).toBeFalsy();
97
+ // });
98
+
99
+ // test('Two data tokens in a single string', function () {
100
+ // const validation: boolean = isTokenLabel(variable8);
101
+ // expect(validation).toBeFalsy();
102
+ // });
103
+
104
+ // test('Single curly brackets and non-empty label', function () {
105
+ // const validation: boolean = isTokenLabel(variable9);
106
+ // expect(validation).toBeFalsy();
107
+ // });
108
+ // });
109
+
110
+ // describe('Regular scenarios', function () {
111
+ // const variable1: string = '{{NOW}}';
112
+ // const variable2: string = '{{LAST_YEAR_END}}';
113
+ // const variable3: string = '{{data.marathonparatooltips-cambiodesorting.FECHA.avg}}';
114
+
115
+ // test('Scenario #1', function () {
116
+ // const validation: boolean = isTokenLabel(variable1);
117
+ // expect(validation).toBeTruthy();
118
+ // });
119
+
120
+ // test('Scenario #2', function () {
121
+ // const validation: boolean = isTokenLabel(variable2);
122
+ // expect(validation).toBeTruthy();
123
+ // });
124
+
125
+ // test('Scenario #3', function () {
126
+ // const validation: boolean = isTokenLabel(variable3);
127
+ // expect(validation).toBeTruthy();
128
+ // });
129
+ // });
130
+
131
+ const { isTokenLabel } = require("../../dist/cjs");
132
+
133
+ describe('Testing undefined argument', function () {
134
+ test('no argument passed', function () {
135
+ const validation = isTokenLabel();
136
+ expect(validation).toBeFalsy();
137
+ });
138
+
139
+ test('Undefined argument', function () {
140
+ const validation = isTokenLabel(undefined);
141
+ expect(validation).toBeFalsy();
142
+ });
143
+
144
+ test('Null argument', function () {
145
+ const validation = isTokenLabel(null);
146
+ expect(validation).toBeFalsy();
147
+ });
148
+ });
149
+
150
+ describe('Testing no-string arguments', function () {
151
+ const variable1 = 1;
152
+ const variable2 = false;
153
+ const variable3 = new Date();
154
+ const variable4 = { const1: 'Hello', const2: 'World'};
155
+ const variable5 = ['Hello', 'World'];
156
+
157
+ test('Numeric variable', function () {
158
+ const validation = isTokenLabel(variable1);
159
+ expect(validation).toBeFalsy();
160
+ });
161
+
162
+ test('Boolean variable', function () {
163
+ const validation = isTokenLabel(variable2);
164
+ expect(validation).toBeFalsy();
165
+ });
166
+
167
+ test('Date object variable', function () {
168
+ const validation = isTokenLabel(variable3);
169
+ expect(validation).toBeFalsy();
170
+ });
171
+
172
+ test('Object variable', function () {
173
+ const validation = isTokenLabel(variable4);
174
+ expect(validation).toBeFalsy();
175
+ });
176
+
177
+ test('Array variable', function () {
178
+ const validation = isTokenLabel(variable5);
179
+ expect(validation).toBeFalsy();
180
+ });
181
+ });
182
+
183
+ describe('Testing invalid string argument', function () {
184
+ const variable1 = '';
185
+ const variable2 = 'Hello World';
186
+ const variable3 = '{}';
187
+ const variable4 = '{{}}';
188
+ const variable5 = '{{ }}';
189
+ const variable6 = '{{ Hello }}';
190
+ const variable7 = '{{Hello}';
191
+ const variable8 = '{{Hello}}{{World}}';
192
+ const variable9 = '{Hello}';
193
+
194
+ test('Empty string', function () {
195
+ const validation = isTokenLabel(variable1);
196
+ expect(validation).toBeFalsy();
197
+ });
198
+
199
+ test('Non-empty and regular string', function () {
200
+ const validation = isTokenLabel(variable2);
201
+ expect(validation).toBeFalsy();
202
+ });
203
+
204
+ test('Single curly brackets and empty label', function () {
205
+ const validation = isTokenLabel(variable3);
206
+ expect(validation).toBeFalsy();
207
+ });
208
+
209
+ test('Double curly brackets and empty label', function () {
210
+ const validation = isTokenLabel(variable4);
211
+ expect(validation).toBeFalsy();
212
+ });
213
+
214
+ test('Double curly brackets and space between them', function () {
215
+ const validation = isTokenLabel(variable5);
216
+ expect(validation).toBeFalsy();
217
+ });
218
+
219
+ test('Double curly brackets and non-empty label with space between them', function () {
220
+ const validation = isTokenLabel(variable6);
221
+ expect(validation).toBeFalsy();
222
+ });
223
+
224
+ test('Double left and single right curly brackets and non-empty label', function () {
225
+ const validation = isTokenLabel(variable7);
226
+ expect(validation).toBeFalsy();
227
+ });
228
+
229
+ test('Two data tokens in a single string', function () {
230
+ const validation = isTokenLabel(variable8);
231
+ expect(validation).toBeFalsy();
232
+ });
233
+
234
+ test('Single curly brackets and non-empty label', function () {
235
+ const validation = isTokenLabel(variable9);
236
+ expect(validation).toBeFalsy();
237
+ });
238
+ });
239
+
240
+ describe('Regular scenarios', function () {
241
+ const variable1 = '{{NOW}}';
242
+ const variable2 = '{{LAST_YEAR_END}}';
243
+ const variable3 = '{{data.marathonparatooltips-cambiodesorting.FECHA.avg}}';
244
+
245
+ test('Scenario #1', function () {
246
+ const validation = isTokenLabel(variable1);
247
+ expect(validation).toBeTruthy();
248
+ });
249
+
250
+ test('Scenario #2', function () {
251
+ const validation = isTokenLabel(variable2);
252
+ expect(validation).toBeTruthy();
253
+ });
254
+
255
+ test('Scenario #3', function () {
256
+ const validation = isTokenLabel(variable3);
257
+ expect(validation).toBeTruthy();
258
+ });
259
+ });
package/tsconfig.json CHANGED
@@ -62,11 +62,5 @@
62
62
 
63
63
  /* Advanced Options */
64
64
  "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
65
- },
66
- "include": [
67
- "src"
68
- ],
69
- "exclude": [
70
- "test"
71
- ]
65
+ }
72
66
  }
@@ -1,129 +0,0 @@
1
- import { isTokenLabel } from '../../src/tokens/isTokenLabel';
2
-
3
- describe('Testing undefined argument', function () {
4
- test('no argument passed', function () {
5
- const validation: boolean = isTokenLabel();
6
- expect(validation).toBeFalsy();
7
- });
8
-
9
- test('Undefined argument', function () {
10
- const validation: boolean = isTokenLabel(undefined);
11
- expect(validation).toBeFalsy();
12
- });
13
-
14
- test('Null argument', function () {
15
- const validation: boolean = isTokenLabel(null);
16
- expect(validation).toBeFalsy();
17
- });
18
- });
19
-
20
- describe('Testing no-string arguments', function () {
21
- const variable1: any = 1;
22
- const variable2: any = false;
23
- const variable3: any = new Date();
24
- const variable4: any = { const1: 'Hello', const2: 'World'};
25
- const variable5: any = ['Hello', 'World'];
26
-
27
- test('Numeric variable', function () {
28
- const validation: boolean = isTokenLabel(variable1);
29
- expect(validation).toBeFalsy();
30
- });
31
-
32
- test('Boolean variable', function () {
33
- const validation: boolean = isTokenLabel(variable2);
34
- expect(validation).toBeFalsy();
35
- });
36
-
37
- test('Date object variable', function () {
38
- const validation: boolean = isTokenLabel(variable3);
39
- expect(validation).toBeFalsy();
40
- });
41
-
42
- test('Object variable', function () {
43
- const validation: boolean = isTokenLabel(variable4);
44
- expect(validation).toBeFalsy();
45
- });
46
-
47
- test('Array variable', function () {
48
- const validation: boolean = isTokenLabel(variable5);
49
- expect(validation).toBeFalsy();
50
- });
51
- });
52
-
53
- describe('Testing invalid string argument', function () {
54
- const variable1: string = '';
55
- const variable2: string = 'Hello World';
56
- const variable3: string = '{}';
57
- const variable4: string = '{{}}';
58
- const variable5: string = '{{ }}';
59
- const variable6: string = '{{ Hello }}';
60
- const variable7: string = '{{Hello}';
61
- const variable8: string = '{{Hello}}{{World}}';
62
- const variable9: string = '{Hello}';
63
-
64
- test('Empty string', function () {
65
- const validation: boolean = isTokenLabel(variable1);
66
- expect(validation).toBeFalsy();
67
- });
68
-
69
- test('Non-empty and regular string', function () {
70
- const validation: boolean = isTokenLabel(variable2);
71
- expect(validation).toBeFalsy();
72
- });
73
-
74
- test('Single curly brackets and empty label', function () {
75
- const validation: boolean = isTokenLabel(variable3);
76
- expect(validation).toBeFalsy();
77
- });
78
-
79
- test('Double curly brackets and empty label', function () {
80
- const validation: boolean = isTokenLabel(variable4);
81
- expect(validation).toBeFalsy();
82
- });
83
-
84
- test('Double curly brackets and space between them', function () {
85
- const validation: boolean = isTokenLabel(variable5);
86
- expect(validation).toBeFalsy();
87
- });
88
-
89
- test('Double curly brackets and non-empty label with space between them', function () {
90
- const validation: boolean = isTokenLabel(variable6);
91
- expect(validation).toBeFalsy();
92
- });
93
-
94
- test('Double left and single right curly brackets and non-empty label', function () {
95
- const validation: boolean = isTokenLabel(variable7);
96
- expect(validation).toBeFalsy();
97
- });
98
-
99
- test('Two data tokens in a single string', function () {
100
- const validation: boolean = isTokenLabel(variable8);
101
- expect(validation).toBeFalsy();
102
- });
103
-
104
- test('Single curly brackets and non-empty label', function () {
105
- const validation: boolean = isTokenLabel(variable9);
106
- expect(validation).toBeFalsy();
107
- });
108
- });
109
-
110
- describe('Regular scenarios', function () {
111
- const variable1: string = '{{NOW}}';
112
- const variable2: string = '{{LAST_YEAR_END}}';
113
- const variable3: string = '{{data.marathonparatooltips-cambiodesorting.FECHA.avg}}';
114
-
115
- test('Scenario #1', function () {
116
- const validation: boolean = isTokenLabel(variable1);
117
- expect(validation).toBeTruthy();
118
- });
119
-
120
- test('Scenario #2', function () {
121
- const validation: boolean = isTokenLabel(variable2);
122
- expect(validation).toBeTruthy();
123
- });
124
-
125
- test('Scenario #3', function () {
126
- const validation: boolean = isTokenLabel(variable3);
127
- expect(validation).toBeTruthy();
128
- });
129
- });