@vizabi/reader-ddfcsv 4.5.3 → 4.5.5

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 (137) hide show
  1. package/.nyc_output/574fe7f0-58f6-4de2-9524-16e72b784218.json +1 -0
  2. package/.nyc_output/9aede69f-00e6-432d-bdeb-2c9f4084a6dc.json +1 -0
  3. package/.nyc_output/processinfo/574fe7f0-58f6-4de2-9524-16e72b784218.json +1 -0
  4. package/.nyc_output/processinfo/9aede69f-00e6-432d-bdeb-2c9f4084a6dc.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -0
  6. package/LICENSE +0 -0
  7. package/README.md +2 -2
  8. package/coverage/base.css +224 -0
  9. package/coverage/block-navigation.js +87 -0
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +161 -0
  12. package/coverage/prettify.css +1 -0
  13. package/coverage/prettify.js +2 -0
  14. package/coverage/sort-arrow-sprite.png +0 -0
  15. package/coverage/sorter.js +210 -0
  16. package/coverage/src/ddf-csv.ts.html +2866 -0
  17. package/coverage/src/ddfcsv-error.ts.html +148 -0
  18. package/coverage/src/ddfcsv-reader.ts.html +538 -0
  19. package/coverage/src/file-readers/backend-file-reader.ts.html +175 -0
  20. package/coverage/src/file-readers/github-path-adapter.ts.html +244 -0
  21. package/coverage/src/file-readers/index.html +131 -0
  22. package/coverage/src/index.html +176 -0
  23. package/coverage/src/index.ts.html +145 -0
  24. package/coverage/src/interfaces.ts.html +196 -0
  25. package/coverage/src/resource-selection-optimizer/in-clause-under-conjunction.ts.html +745 -0
  26. package/coverage/src/resource-selection-optimizer/index.html +131 -0
  27. package/coverage/src/resource-selection-optimizer/index.ts.html +118 -0
  28. package/coverage/src/test-cases/concepts.ts.html +166 -0
  29. package/coverage/src/test-cases/entities.ts.html +241 -0
  30. package/coverage/src/test-cases/index.html +131 -0
  31. package/dist/reader-ddfcsv.js +15 -1
  32. package/dist/reader-ddfcsv.js.map +1 -0
  33. package/dist/stats.html +4950 -0
  34. package/icon.png +0 -0
  35. package/lib/src/ddf-csv.d.ts +0 -0
  36. package/lib/src/ddf-csv.js +13 -14
  37. package/lib/src/ddf-csv.js.map +1 -1
  38. package/lib/src/ddfcsv-error.d.ts +0 -0
  39. package/lib/src/ddfcsv-error.js +0 -0
  40. package/lib/src/ddfcsv-error.js.map +0 -0
  41. package/lib/src/ddfcsv-reader.d.ts +0 -0
  42. package/lib/src/ddfcsv-reader.js +5 -5
  43. package/lib/src/ddfcsv-reader.js.map +1 -1
  44. package/lib/src/file-readers/backend-file-reader.d.ts +0 -0
  45. package/lib/src/file-readers/backend-file-reader.js +0 -0
  46. package/lib/src/file-readers/backend-file-reader.js.map +0 -0
  47. package/lib/src/file-readers/github-path-adapter.d.ts +0 -0
  48. package/lib/src/file-readers/github-path-adapter.js +0 -0
  49. package/lib/src/file-readers/github-path-adapter.js.map +0 -0
  50. package/lib/src/index.d.ts +0 -0
  51. package/lib/src/index.js +2 -2
  52. package/lib/src/index.js.map +0 -0
  53. package/lib/src/interfaces.d.ts +0 -0
  54. package/lib/src/interfaces.js +0 -0
  55. package/lib/src/interfaces.js.map +0 -0
  56. package/lib/src/resource-selection-optimizer/in-clause-under-conjunction.d.ts +0 -0
  57. package/lib/src/resource-selection-optimizer/in-clause-under-conjunction.js +16 -17
  58. package/lib/src/resource-selection-optimizer/in-clause-under-conjunction.js.map +1 -1
  59. package/lib/src/resource-selection-optimizer/index.d.ts +0 -0
  60. package/lib/src/resource-selection-optimizer/index.js +2 -2
  61. package/lib/src/resource-selection-optimizer/index.js.map +1 -1
  62. package/lib-web/src/ddf-csv.d.ts +0 -0
  63. package/lib-web/src/ddf-csv.js +30 -34
  64. package/lib-web/src/ddf-csv.js.map +1 -1
  65. package/lib-web/src/ddfcsv-error.d.ts +0 -0
  66. package/lib-web/src/ddfcsv-error.js +5 -9
  67. package/lib-web/src/ddfcsv-error.js.map +1 -1
  68. package/lib-web/src/ddfcsv-reader.d.ts +0 -0
  69. package/lib-web/src/ddfcsv-reader.js +16 -19
  70. package/lib-web/src/ddfcsv-reader.js.map +1 -1
  71. package/lib-web/src/file-readers/frontend-file-reader.d.ts +0 -0
  72. package/lib-web/src/file-readers/frontend-file-reader.js +1 -5
  73. package/lib-web/src/file-readers/frontend-file-reader.js.map +1 -1
  74. package/lib-web/src/file-readers/github-path-adapter.d.ts +0 -0
  75. package/lib-web/src/file-readers/github-path-adapter.js +1 -4
  76. package/lib-web/src/file-readers/github-path-adapter.js.map +1 -1
  77. package/lib-web/src/index-web.d.ts +0 -0
  78. package/lib-web/src/index-web.js +9 -14
  79. package/lib-web/src/index-web.js.map +1 -1
  80. package/lib-web/src/interfaces.d.ts +0 -0
  81. package/lib-web/src/interfaces.js +1 -2
  82. package/lib-web/src/interfaces.js.map +0 -0
  83. package/lib-web/src/resource-selection-optimizer/in-clause-under-conjunction.d.ts +0 -0
  84. package/lib-web/src/resource-selection-optimizer/in-clause-under-conjunction.js +12 -17
  85. package/lib-web/src/resource-selection-optimizer/in-clause-under-conjunction.js.map +1 -1
  86. package/lib-web/src/resource-selection-optimizer/index.d.ts +0 -0
  87. package/lib-web/src/resource-selection-optimizer/index.js +4 -7
  88. package/lib-web/src/resource-selection-optimizer/index.js.map +1 -1
  89. package/package.json +94 -129
  90. package/rollup.config.mjs +36 -0
  91. package/scripts/set-own-version.js +0 -0
  92. package/src/ddf-csv.ts +927 -927
  93. package/src/ddfcsv-error.ts +0 -0
  94. package/src/ddfcsv-reader.ts +151 -151
  95. package/src/file-readers/backend-file-reader.ts +0 -0
  96. package/src/file-readers/frontend-file-reader.ts +0 -0
  97. package/src/file-readers/github-path-adapter.ts +0 -0
  98. package/src/index-web.ts +0 -0
  99. package/src/index.ts +0 -0
  100. package/src/interfaces.ts +0 -0
  101. package/src/resource-selection-optimizer/in-clause-under-conjunction.ts +220 -220
  102. package/src/resource-selection-optimizer/index.ts +11 -11
  103. package/src/test-cases/concepts.ts +0 -0
  104. package/src/test-cases/entities.ts +52 -52
  105. package/test/assets-fixtures/world-50m.json +0 -0
  106. package/test/assets.spec.ts +0 -0
  107. package/test/common.ts +1 -1
  108. package/test/definition/concepts-definition.spec.ts +0 -0
  109. package/test/definition/datapoints-definition.spec.ts +1 -1
  110. package/test/definition/entities-definition.spec.ts +264 -264
  111. package/test/definition/schema-definition.spec.ts +0 -0
  112. package/test/diagnostics.spec.ts +0 -0
  113. package/test/features-service.spec.ts +95 -95
  114. package/test/high-load.spec.ts +0 -0
  115. package/test/main.spec.ts +0 -0
  116. package/test/multi-instances.spec.ts +0 -0
  117. package/test/result-fixtures/datapoints-assets.json +0 -0
  118. package/test/result-fixtures/in-clause-under-conjunction-1.json +0 -0
  119. package/test/result-fixtures/in-clause-under-conjunction-2.json +0 -0
  120. package/test/result-fixtures/multi-instances/concepts-sg.json +0 -0
  121. package/test/result-fixtures/multi-instances/concepts-soderstornsmodellen.json +0 -0
  122. package/test/result-fixtures/multi-instances/datapoints-sg.json +0 -0
  123. package/test/result-fixtures/multi-instances/datapoints-soderstornsmodellen.json +0 -0
  124. package/test/result-fixtures/multi-instances/entities-sg.json +0 -0
  125. package/test/result-fixtures/multi-instances/entities-soderstornsmodellen.json +0 -0
  126. package/test/result-fixtures/multi-instances/schema-sg.json +0 -0
  127. package/test/result-fixtures/multi-instances/schema-soderstornsmodellen.json +0 -0
  128. package/test/schema.spec.ts +0 -0
  129. package/test/tslint.json +0 -0
  130. package/tsconfig-web.json +41 -41
  131. package/tsconfig.json +40 -37
  132. package/tslint.json +0 -0
  133. package/.travis.yml +0 -37
  134. package/deploy.js +0 -87
  135. package/dist/reader-ddfcsv-polyfill.js +0 -2
  136. package/dist/reader-ddfcsv-polyfill.js.map +0 -1
  137. package/test/mocha.opts +0 -7
@@ -1,264 +1,264 @@
1
- import 'mocha';
2
- import * as chai from 'chai';
3
- import * as keys from 'lodash.keys';
4
- import {
5
- BASE_PATH,
6
- expectPromiseRejection,
7
- GLOBALIS_PATH,
8
- selectKeyClauseContainsUnavailableItems,
9
- selectKeyClauseMustHaveOnly1Item,
10
- selectValueClauseContainsUnavailableItems1,
11
- WS_TESTING_PATH
12
- } from '../common';
13
- import { getDDFCsvReaderObject } from '../../src/index';
14
- import {
15
- CONCEPT_TYPE_ENTITY_DOMAIN,
16
- CONCEPT_TYPE_ENTITY_SET,
17
- isEntityDomainOrSet,
18
- RESERVED_CONCEPT,
19
- RESERVED_CONCEPT_TYPE,
20
- RESERVED_DOMAIN,
21
- RESERVED_DRILL_UP
22
- } from '@vizabi/ddf-query-validator';
23
- import { testsDescriptors, initData } from '../../src/test-cases/entities';
24
-
25
- const expect = chai.expect;
26
-
27
- describe('Entities definition errors in query', () => {
28
- const descriptions = keys(testsDescriptors);
29
-
30
- for (const description of descriptions) {
31
- describe(description, () => {
32
- for (const testsDescriptor of testsDescriptors[ description ]) {
33
- it(testsDescriptor.itTitle, async () => {
34
- const reader = getDDFCsvReaderObject();
35
-
36
- let data;
37
-
38
- try {
39
- await reader.init(initData);
40
- data = await reader.read(testsDescriptor.query);
41
- } catch (error) {
42
- throw error;
43
- }
44
-
45
- expect(data).to.not.null;
46
- });
47
- }
48
- });
49
- }
50
-
51
- describe('should never happen for happy flow', () => {
52
- it(`when requests '${BASE_PATH + GLOBALIS_PATH}' dataset and 'ar-SA' language`, async () => {
53
- const reader = getDDFCsvReaderObject();
54
-
55
- reader.init({});
56
-
57
- const query = {
58
- repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
59
- language: 'ar-SA',
60
- select: {
61
- key: [ 'country' ],
62
- value: [ 'world_4region' ]
63
- },
64
- from: 'entities',
65
- where: {
66
- $and: [
67
- { country: { $in: [ 'usa', 'dza', 'abkh', 'afg' ] } }
68
- ]
69
- },
70
- order_by: [ 'country' ]
71
- };
72
- const result = await reader.read(query);
73
- expect(result.length).to.equal(4);
74
- });
75
-
76
- it(`when requests '${BASE_PATH + GLOBALIS_PATH}' dataset without 'en' language in datapackage.json`, async () => {
77
- const reader = getDDFCsvReaderObject();
78
-
79
- reader.init({});
80
-
81
- const query = {
82
- repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
83
- from: 'entities',
84
- language: 'test',
85
- select: {
86
- key: [ 'country' ],
87
- value: [ 'world_4region', 'un_state' ]
88
- },
89
- order_by: [ 'country', { world_4region: -1 } ]
90
- };
91
- const result = await reader.read(query);
92
-
93
- expect(result.length).to.equal(273);
94
- });
95
-
96
- it(`when requests only one column '${BASE_PATH + GLOBALIS_PATH}' dataset`, async () => {
97
- const reader = getDDFCsvReaderObject();
98
-
99
- reader.init({});
100
-
101
- const query = {
102
- repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
103
- language: 'ar-SA',
104
- select: {
105
- key: [ 'country' ]
106
- },
107
- from: 'entities',
108
- where: {
109
- $and: [
110
- { country: { $in: [ 'usa', 'dza', 'abkh', 'afg' ] } }
111
- ]
112
- }
113
- };
114
- const result = await reader.read(query);
115
-
116
- expect(result.length).to.equal(4);
117
- });
118
-
119
- it('when requests entities with where clause', async () => {
120
- const reader = getDDFCsvReaderObject();
121
- reader.init({});
122
-
123
- const query = {
124
- repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
125
- where: { world_6region: '$world_6region' },
126
- select: { key: [ 'country' ], value: [ 'world_6region', 'landlocked' ] },
127
- from: 'entities',
128
- join: {
129
- $world_6region: {
130
- key: 'world_6region',
131
- where: {
132
- rank: { $eq: 2 }
133
- }
134
- }
135
- }
136
- };
137
- const result = await reader.read(query);
138
-
139
- expect(result).to.be.deep.equal([
140
- {
141
- country: 'afg',
142
- landlocked: 'landlocked',
143
- world_6region: 'south_asia'
144
- },
145
- {
146
- country: 'bgd',
147
- landlocked: 'coastline',
148
- world_6region: 'south_asia'
149
- },
150
- {
151
- country: 'btn',
152
- landlocked: 'landlocked',
153
- world_6region: 'south_asia'
154
- },
155
- {
156
- country: 'ind',
157
- landlocked: 'coastline',
158
- world_6region: 'south_asia'
159
- },
160
- {
161
- country: 'lka',
162
- landlocked: 'coastline',
163
- world_6region: 'south_asia'
164
- },
165
- {
166
- country: 'mdv',
167
- landlocked: 'coastline',
168
- world_6region: 'south_asia'
169
- },
170
- {
171
- country: 'npl',
172
- landlocked: 'landlocked',
173
- world_6region: 'south_asia'
174
- },
175
- {
176
- country: 'pak',
177
- landlocked: 'coastline',
178
- world_6region: 'south_asia'
179
- }
180
- ]);
181
- });
182
- });
183
-
184
- describe('should be produced only for \'select\' section', () => {
185
-
186
- it('when \'key\' property has item that is absent in dataset', async () => {
187
- const reader = getDDFCsvReaderObject();
188
-
189
- reader.init({});
190
-
191
- const query = {
192
- repositoryPath: BASE_PATH + WS_TESTING_PATH + '/master-HEAD',
193
- select: {
194
- key: [ 'failed_concept' ],
195
- value: [ 'company_scale', 'english_speaking' ]
196
- },
197
- from: 'entities'
198
- };
199
-
200
- await expectPromiseRejection({
201
- promiseFunction: reader.read.bind(reader),
202
- args: [ query ],
203
- expectedErrors: [ selectKeyClauseContainsUnavailableItems ],
204
- type: 'definitions'
205
- });
206
- });
207
-
208
- it('when \'key\' property has many items (structure error)', async () => {
209
- const reader = getDDFCsvReaderObject();
210
- reader.init({});
211
-
212
- const query = {
213
- repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
214
- from: 'entities', select: { key: [ 'geo', 'failed_concept' ] }
215
- };
216
-
217
- await expectPromiseRejection({
218
- promiseFunction: reader.read.bind(reader),
219
- args: [ query ],
220
- expectedErrors: [ selectKeyClauseMustHaveOnly1Item ],
221
- type: 'structure'
222
- });
223
- });
224
-
225
- it('when debug mode and \'value\' property has items that is absent in dataset', async () => {
226
- const reader = getDDFCsvReaderObject();
227
- reader.init({});
228
-
229
- const query = {
230
- repositoryPath: BASE_PATH + WS_TESTING_PATH + '/master-HEAD',
231
- from: 'entities',
232
- debug: true,
233
- select: {
234
- key: [ 'company' ],
235
- value: [ 'failed_concept', 'english_speaking', 'company_scale', 'failed_concept2', 'lines_of_code' ]
236
- }
237
- };
238
-
239
- await expectPromiseRejection({
240
- promiseFunction: reader.read.bind(reader),
241
- args: [ query ],
242
- expectedErrors: [ selectValueClauseContainsUnavailableItems1 ],
243
- type: 'definitions'
244
- });
245
- });
246
-
247
- it('when \'value\' property has items that is absent in dataset', async () => {
248
- const reader = getDDFCsvReaderObject();
249
- reader.init({});
250
-
251
- const query = {
252
- repositoryPath: BASE_PATH + WS_TESTING_PATH + '/master-HEAD',
253
- from: 'entities',
254
- select: {
255
- key: [ 'company' ],
256
- value: [ 'failed_concept', 'english_speaking', 'company_scale', 'failed_concept2', 'lines_of_code' ]
257
- }
258
- };
259
-
260
- const result = await reader.read(query);
261
- expect(result).to.be.deep.equal([]);
262
- });
263
- });
264
- });
1
+ import 'mocha';
2
+ import * as chai from 'chai';
3
+ import keys from 'lodash-es/keys';
4
+ import {
5
+ BASE_PATH,
6
+ expectPromiseRejection,
7
+ GLOBALIS_PATH,
8
+ selectKeyClauseContainsUnavailableItems,
9
+ selectKeyClauseMustHaveOnly1Item,
10
+ selectValueClauseContainsUnavailableItems1,
11
+ WS_TESTING_PATH
12
+ } from '../common';
13
+ import { getDDFCsvReaderObject } from '../../src/index';
14
+ import {
15
+ CONCEPT_TYPE_ENTITY_DOMAIN,
16
+ CONCEPT_TYPE_ENTITY_SET,
17
+ isEntityDomainOrSet,
18
+ RESERVED_CONCEPT,
19
+ RESERVED_CONCEPT_TYPE,
20
+ RESERVED_DOMAIN,
21
+ RESERVED_DRILL_UP
22
+ } from '@vizabi/ddf-query-validator';
23
+ import { testsDescriptors, initData } from '../../src/test-cases/entities';
24
+
25
+ const expect = chai.expect;
26
+
27
+ describe('Entities definition errors in query', () => {
28
+ const descriptions = keys(testsDescriptors);
29
+
30
+ for (const description of descriptions) {
31
+ describe(description, () => {
32
+ for (const testsDescriptor of testsDescriptors[ description ]) {
33
+ it(testsDescriptor.itTitle, async () => {
34
+ const reader = getDDFCsvReaderObject();
35
+
36
+ let data;
37
+
38
+ try {
39
+ await reader.init(initData);
40
+ data = await reader.read(testsDescriptor.query);
41
+ } catch (error) {
42
+ throw error;
43
+ }
44
+
45
+ expect(data).to.not.null;
46
+ });
47
+ }
48
+ });
49
+ }
50
+
51
+ describe('should never happen for happy flow', () => {
52
+ it(`when requests '${BASE_PATH + GLOBALIS_PATH}' dataset and 'ar-SA' language`, async () => {
53
+ const reader = getDDFCsvReaderObject();
54
+
55
+ reader.init({});
56
+
57
+ const query = {
58
+ repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
59
+ language: 'ar-SA',
60
+ select: {
61
+ key: [ 'country' ],
62
+ value: [ 'world_4region' ]
63
+ },
64
+ from: 'entities',
65
+ where: {
66
+ $and: [
67
+ { country: { $in: [ 'usa', 'dza', 'abkh', 'afg' ] } }
68
+ ]
69
+ },
70
+ order_by: [ 'country' ]
71
+ };
72
+ const result = await reader.read(query);
73
+ expect(result.length).to.equal(4);
74
+ });
75
+
76
+ it(`when requests '${BASE_PATH + GLOBALIS_PATH}' dataset without 'en' language in datapackage.json`, async () => {
77
+ const reader = getDDFCsvReaderObject();
78
+
79
+ reader.init({});
80
+
81
+ const query = {
82
+ repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
83
+ from: 'entities',
84
+ language: 'test',
85
+ select: {
86
+ key: [ 'country' ],
87
+ value: [ 'world_4region', 'un_state' ]
88
+ },
89
+ order_by: [ 'country', { world_4region: -1 } ]
90
+ };
91
+ const result = await reader.read(query);
92
+
93
+ expect(result.length).to.equal(273);
94
+ });
95
+
96
+ it(`when requests only one column '${BASE_PATH + GLOBALIS_PATH}' dataset`, async () => {
97
+ const reader = getDDFCsvReaderObject();
98
+
99
+ reader.init({});
100
+
101
+ const query = {
102
+ repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
103
+ language: 'ar-SA',
104
+ select: {
105
+ key: [ 'country' ]
106
+ },
107
+ from: 'entities',
108
+ where: {
109
+ $and: [
110
+ { country: { $in: [ 'usa', 'dza', 'abkh', 'afg' ] } }
111
+ ]
112
+ }
113
+ };
114
+ const result = await reader.read(query);
115
+
116
+ expect(result.length).to.equal(4);
117
+ });
118
+
119
+ it('when requests entities with where clause', async () => {
120
+ const reader = getDDFCsvReaderObject();
121
+ reader.init({});
122
+
123
+ const query = {
124
+ repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
125
+ where: { world_6region: '$world_6region' },
126
+ select: { key: [ 'country' ], value: [ 'world_6region', 'landlocked' ] },
127
+ from: 'entities',
128
+ join: {
129
+ $world_6region: {
130
+ key: 'world_6region',
131
+ where: {
132
+ rank: { $eq: 2 }
133
+ }
134
+ }
135
+ }
136
+ };
137
+ const result = await reader.read(query);
138
+
139
+ expect(result).to.be.deep.equal([
140
+ {
141
+ country: 'afg',
142
+ landlocked: 'landlocked',
143
+ world_6region: 'south_asia'
144
+ },
145
+ {
146
+ country: 'bgd',
147
+ landlocked: 'coastline',
148
+ world_6region: 'south_asia'
149
+ },
150
+ {
151
+ country: 'btn',
152
+ landlocked: 'landlocked',
153
+ world_6region: 'south_asia'
154
+ },
155
+ {
156
+ country: 'ind',
157
+ landlocked: 'coastline',
158
+ world_6region: 'south_asia'
159
+ },
160
+ {
161
+ country: 'lka',
162
+ landlocked: 'coastline',
163
+ world_6region: 'south_asia'
164
+ },
165
+ {
166
+ country: 'mdv',
167
+ landlocked: 'coastline',
168
+ world_6region: 'south_asia'
169
+ },
170
+ {
171
+ country: 'npl',
172
+ landlocked: 'landlocked',
173
+ world_6region: 'south_asia'
174
+ },
175
+ {
176
+ country: 'pak',
177
+ landlocked: 'coastline',
178
+ world_6region: 'south_asia'
179
+ }
180
+ ]);
181
+ });
182
+ });
183
+
184
+ describe('should be produced only for \'select\' section', () => {
185
+
186
+ it('when \'key\' property has item that is absent in dataset', async () => {
187
+ const reader = getDDFCsvReaderObject();
188
+
189
+ reader.init({});
190
+
191
+ const query = {
192
+ repositoryPath: BASE_PATH + WS_TESTING_PATH + '/master-HEAD',
193
+ select: {
194
+ key: [ 'failed_concept' ],
195
+ value: [ 'company_scale', 'english_speaking' ]
196
+ },
197
+ from: 'entities'
198
+ };
199
+
200
+ await expectPromiseRejection({
201
+ promiseFunction: reader.read.bind(reader),
202
+ args: [ query ],
203
+ expectedErrors: [ selectKeyClauseContainsUnavailableItems ],
204
+ type: 'definitions'
205
+ });
206
+ });
207
+
208
+ it('when \'key\' property has many items (structure error)', async () => {
209
+ const reader = getDDFCsvReaderObject();
210
+ reader.init({});
211
+
212
+ const query = {
213
+ repositoryPath: BASE_PATH + GLOBALIS_PATH + '/master-HEAD',
214
+ from: 'entities', select: { key: [ 'geo', 'failed_concept' ] }
215
+ };
216
+
217
+ await expectPromiseRejection({
218
+ promiseFunction: reader.read.bind(reader),
219
+ args: [ query ],
220
+ expectedErrors: [ selectKeyClauseMustHaveOnly1Item ],
221
+ type: 'structure'
222
+ });
223
+ });
224
+
225
+ it('when debug mode and \'value\' property has items that is absent in dataset', async () => {
226
+ const reader = getDDFCsvReaderObject();
227
+ reader.init({});
228
+
229
+ const query = {
230
+ repositoryPath: BASE_PATH + WS_TESTING_PATH + '/master-HEAD',
231
+ from: 'entities',
232
+ debug: true,
233
+ select: {
234
+ key: [ 'company' ],
235
+ value: [ 'failed_concept', 'english_speaking', 'company_scale', 'failed_concept2', 'lines_of_code' ]
236
+ }
237
+ };
238
+
239
+ await expectPromiseRejection({
240
+ promiseFunction: reader.read.bind(reader),
241
+ args: [ query ],
242
+ expectedErrors: [ selectValueClauseContainsUnavailableItems1 ],
243
+ type: 'definitions'
244
+ });
245
+ });
246
+
247
+ it('when \'value\' property has items that is absent in dataset', async () => {
248
+ const reader = getDDFCsvReaderObject();
249
+ reader.init({});
250
+
251
+ const query = {
252
+ repositoryPath: BASE_PATH + WS_TESTING_PATH + '/master-HEAD',
253
+ from: 'entities',
254
+ select: {
255
+ key: [ 'company' ],
256
+ value: [ 'failed_concept', 'english_speaking', 'company_scale', 'failed_concept2', 'lines_of_code' ]
257
+ }
258
+ };
259
+
260
+ const result = await reader.read(query);
261
+ expect(result).to.be.deep.equal([]);
262
+ });
263
+ });
264
+ });
File without changes
File without changes