@mojaloop/ml-testing-toolkit-shared-lib 12.2.0 → 13.0.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.
@@ -1,138 +0,0 @@
1
- /*****
2
- License
3
- --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
- Contributors
9
- --------------
10
- This is the official list of the Mojaloop project contributors for this file.
11
- Names of the original copyright holders (individuals or organizations)
12
- should be listed with a '*' in the first column. People who have
13
- contributed from an organization can be listed under the organization
14
- that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
16
- their names indented and be marked with a '-'. Email address can be added
17
- optionally within square brackets <email>.
18
- * Gates Foundation
19
-
20
- * ModusBox
21
- * Georgi Logodazhki <georgi.logodazhki@modusbox.com>
22
- * Vijaya Kumar Guthi <vijaya.guthi@modusbox.com> (Original Author)
23
- --------------
24
- ******/
25
-
26
- 'use strict'
27
-
28
- const OpenApiMockGenerator = require('../../../src/lib/openApiMockGenerator')
29
- // const mockGenerator = new OpenApiMockGenerator()
30
- const specFilePrefix = 'test/samples/'
31
-
32
- const jsfRef = [
33
- {
34
- id: 'quoteId'
35
- },
36
- {
37
- id: 'id'
38
- },
39
- {
40
- id: 'state',
41
- pattern: 'Created|Closed'
42
- },
43
- {
44
- id: 'reason',
45
- pattern: 'Created|Closed'
46
- },
47
-
48
- {
49
- id: 'Content-Length',
50
- pattern: '123'
51
- }
52
- ]
53
-
54
- describe('OpenApiMockGenerator', () => {
55
- describe('load a async api file', () => {
56
- const mockGenerator = new OpenApiMockGenerator()
57
- it('Load method should not throw error', async () => {
58
- await expect(mockGenerator.load(specFilePrefix + 'api_spec_async.yaml')).resolves.toBeUndefined()
59
- })
60
- it('generateRequestBody should generate a request body', async () => {
61
- const result = await mockGenerator.generateRequestBody('/quotes', 'post', jsfRef)
62
- expect(result).toHaveProperty('quoteId')
63
- })
64
- it('generateRequestHeaders should generate a request headers', async () => {
65
- const result = await mockGenerator.generateRequestHeaders('/quotes', 'post', jsfRef)
66
- expect(result).toHaveProperty('Accept')
67
- expect(result).toHaveProperty('Content-Type')
68
- expect(result).toHaveProperty('Date')
69
- })
70
- it('generateRequestHeaders should generate a request headers', async () => {
71
- const result = await mockGenerator.generateRequestHeaders('/transfers', 'post')
72
- expect(result).toEqual(expect.anything())
73
- })
74
- it('generateRequestPathParams should generate empty object for path params', async () => {
75
- const result = await mockGenerator.generateRequestPathParams('/transfers', 'post', jsfRef)
76
- expect(result).toEqual({})
77
- })
78
- })
79
- describe('load a sync api file', () => {
80
- const mockGenerator = new OpenApiMockGenerator()
81
- it('Load method should not throw error', async () => {
82
- await expect(mockGenerator.load(specFilePrefix + 'api_spec_sync_empty.yaml')).resolves.toBeUndefined()
83
- })
84
- it('Load method should not throw error', async () => {
85
- await expect(mockGenerator.load(specFilePrefix + 'api_spec_sync.yaml')).resolves.toBeUndefined()
86
- })
87
- it('generateRequestBody should generate a request body', async () => {
88
- const result = await mockGenerator.generateRequestBody('/settlements', 'post', jsfRef)
89
- expect(result).toHaveProperty('reason')
90
- expect(result).toHaveProperty('settlementWindows')
91
- })
92
- it('generateRequestBody should generate a request body', async () => {
93
- const result = await mockGenerator.generateRequestBody('/settlements', 'post')
94
- expect(result).toHaveProperty('reason')
95
- expect(result).toHaveProperty('settlementWindows')
96
- })
97
- it('generateResponseBody should generate a request body', async () => {
98
- const result = await mockGenerator.generateResponseBody('/settlements', 'get', jsfRef)
99
- expect(result).toHaveProperty('body')
100
- expect(result).toHaveProperty('status')
101
- })
102
- it('generateResponseBody should generate a request body', async () => {
103
- const result = await mockGenerator.generateResponseBody('/settlements', 'get')
104
- expect(result).toHaveProperty('body')
105
- expect(result).toHaveProperty('status')
106
- })
107
-
108
- it('generateResponseBody should generate a request body if response type is array', async () => {
109
- const result = await mockGenerator.generateResponseBody('/settlementWindows', 'get', jsfRef)
110
- expect(result).toStrictEqual({})
111
- })
112
- it('generateResponseBody should generate a request body if response type is object', async () => {
113
- const result = await mockGenerator.generateResponseBody('/settlementWindows/{id}', 'get', jsfRef)
114
- expect(result.status).toBe('200')
115
- })
116
- it('generateRequestQueryParams should generate query params', async () => {
117
- const result = await mockGenerator.generateRequestQueryParams('/settlementWindows', 'get')
118
- expect(result).toHaveProperty('fromDateTime')
119
- expect(result).toHaveProperty('participantId')
120
- expect(result).toHaveProperty('state')
121
- })
122
- it('generateRequestQueryParams should generate query params', async () => {
123
- const result = await mockGenerator.generateRequestQueryParams('/settlementWindows', 'get', jsfRef)
124
- console.log(result)
125
- expect(result).toHaveProperty('fromDateTime')
126
- expect(result).toHaveProperty('participantId')
127
- expect(result).toHaveProperty('state')
128
- })
129
- it('generateRequestQueryParams should generate query params', async () => {
130
- const result = await mockGenerator.generateRequestQueryParams('/settlementWindows/{id}', 'get', jsfRef)
131
- expect(result).toEqual({})
132
- })
133
- it('generateRequestPathParams should generate path params', async () => {
134
- const result = await mockGenerator.generateRequestPathParams('/settlementWindows/{id}', 'get', jsfRef)
135
- expect(result).toHaveProperty('id')
136
- })
137
- })
138
- })
@@ -1,502 +0,0 @@
1
- /*****
2
- License
3
- --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
- Contributors
9
- --------------
10
- This is the official list of the Mojaloop project contributors for this file.
11
- Names of the original copyright holders (individuals or organizations)
12
- should be listed with a '*' in the first column. People who have
13
- contributed from an organization can be listed under the organization
14
- that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
16
- their names indented and be marked with a '-'. Email address can be added
17
- optionally within square brackets <email>.
18
- * Gates Foundation
19
-
20
- * ModusBox
21
- * Vijaya Kumar Guthi <vijaya.guthi@modusbox.com> (Original Author)
22
- --------------
23
- ******/
24
-
25
- 'use strict'
26
-
27
- const FolderParser = require('../../../../src/lib/testcase-folder/folder-parser')
28
-
29
- const sampleTestCase = {
30
- id: 1,
31
- name: 'Test Case Name',
32
- requests: []
33
- }
34
-
35
- const sampleFolderRawData = [
36
- {
37
- name: 'name1',
38
- path: 'path1',
39
- size: 123,
40
- modified: 'modified1',
41
- content: { name: 'template1', test_cases: [sampleTestCase] }
42
- },
43
- {
44
- name: 'name2',
45
- path: 'path2',
46
- size: 123,
47
- modified: 'modified2',
48
- content: { name: 'template2', test_cases: [sampleTestCase] }
49
- },
50
- {
51
- name: 'name3',
52
- path: 'path3/name3',
53
- size: 123,
54
- modified: 'modified3',
55
- content: { name: 'template3', test_cases: [sampleTestCase] }
56
- },
57
- {
58
- name: 'name4',
59
- path: 'path3/name4',
60
- size: 123,
61
- modified: 'modified4',
62
- content: { name: 'template4', test_cases: [sampleTestCase] }
63
- },
64
- {
65
- name: 'master.json',
66
- path: 'path3/master.json',
67
- size: 123,
68
- modified: 'modified4',
69
- content: {
70
- order: [
71
- {
72
- name: 'name4',
73
- type: 'file'
74
- },
75
- {
76
- name: 'name3',
77
- type: 'file'
78
- },
79
- {
80
- name: 'name1',
81
- type: 'fileRef',
82
- path: '../path1'
83
- },
84
- {
85
- name: 'name3',
86
- type: 'fileRef',
87
- path: '../path3/name3'
88
- },
89
- {
90
- name: 'name4',
91
- type: 'fileRef',
92
- path: './name4'
93
- }
94
- ]
95
- }
96
- }
97
- ]
98
-
99
- const sampleFolderRawDataWithLabels = [
100
- {
101
- name: 'name1',
102
- path: 'name1',
103
- size: 123,
104
- modified: 'modified1',
105
- content: { name: 'template1', test_cases: [sampleTestCase] }
106
- },
107
- {
108
- name: 'name2',
109
- path: 'name2',
110
- size: 123,
111
- modified: 'modified2',
112
- content: { name: 'template2', test_cases: [sampleTestCase] }
113
- },
114
- {
115
- name: 'master.json',
116
- path: 'master.json',
117
- size: 123,
118
- modified: 'modified4',
119
- content: {
120
- order: [
121
- {
122
- name: 'name1',
123
- type: 'file',
124
- labels: ['p2p']
125
- },
126
- {
127
- name: 'name2',
128
- type: 'file'
129
- }
130
- ]
131
- }
132
- }
133
- ]
134
-
135
- const sampleFolderRawDataWithMultipleFolderLevels = [
136
- {
137
- name: 'name1',
138
- path: 'path1',
139
- size: 123,
140
- modified: 'modified1',
141
- content: { name: 'template1', test_cases: [sampleTestCase] }
142
- },
143
- {
144
- name: 'name2',
145
- path: 'path2/subpath21/name2',
146
- size: 123,
147
- modified: 'modified2',
148
- content: { name: 'template2', test_cases: [sampleTestCase] }
149
- },
150
- {
151
- name: 'name3',
152
- path: 'path2/subpath22/name3',
153
- size: 123,
154
- modified: 'modified3',
155
- content: { name: 'template3', test_cases: [sampleTestCase] }
156
- },
157
- {
158
- name: 'name4',
159
- path: 'path2/name4',
160
- size: 123,
161
- modified: 'modified4',
162
- content: { name: 'template4', test_cases: [sampleTestCase] }
163
- }
164
- ]
165
-
166
- const sampleWrongFolderRawDataWithoutTestCases = [
167
- {
168
- name: 'name1',
169
- path: 'path1',
170
- size: 123,
171
- modified: 'modified1',
172
- content: { name: 'template1' }
173
- }
174
- ]
175
- const sampleWrongFolderRawDataWithWrongFileRef = [
176
- {
177
- name: 'name1',
178
- path: 'path1',
179
- size: 123,
180
- modified: 'modified1',
181
- content: { name: 'template1', test_cases: [sampleTestCase] }
182
- },
183
- {
184
- name: 'name2',
185
- path: 'path2',
186
- size: 123,
187
- modified: 'modified2',
188
- content: { name: 'template2', test_cases: [sampleTestCase] }
189
- },
190
- {
191
- name: 'master.json',
192
- path: 'master.json',
193
- size: 123,
194
- modified: 'modified3',
195
- content: {
196
- order: [
197
- {
198
- name: 'name1',
199
- type: 'file'
200
- },
201
- {
202
- name: 'name2',
203
- type: 'file'
204
- },
205
- {
206
- name: 'name1',
207
- type: 'fileRef',
208
- path: 'path3'
209
- }
210
- ]
211
- }
212
- }
213
- ]
214
-
215
- const sampleWrongFolderRawDataWithFileRefWrongRelativePath = [
216
- {
217
- name: 'name1',
218
- path: 'path1',
219
- size: 123,
220
- modified: 'modified1',
221
- content: { name: 'template1', test_cases: [sampleTestCase] }
222
- },
223
- {
224
- name: 'master.json',
225
- path: 'master.json',
226
- size: 123,
227
- modified: 'modified3',
228
- content: {
229
- order: [
230
- {
231
- name: 'name1',
232
- type: 'file'
233
- },
234
- {
235
- name: 'name1',
236
- type: 'fileRef',
237
- path: '../path1'
238
- }
239
- ]
240
- }
241
- }
242
- ]
243
-
244
- const sampleWrongFolderRawDataWithWithUnknownType = [
245
- {
246
- name: 'name1',
247
- path: 'name1',
248
- size: 123,
249
- modified: 'modified1',
250
- content: { name: 'template1', test_cases: [sampleTestCase] }
251
- },
252
- {
253
- name: 'master.json',
254
- path: 'master.json',
255
- size: 123,
256
- modified: 'modified3',
257
- content: {
258
- order: [
259
- {
260
- name: 'name1',
261
- type: 'unknown'
262
- }
263
- ]
264
- }
265
- }
266
- ]
267
-
268
- const sampleSelectedFiles = [
269
- 'path1'
270
- ]
271
-
272
- const sampleSelectedLabels = [
273
- 'p2p'
274
- ]
275
-
276
- const sampleSelectedFilesWrongPath = [
277
- 'wrongpath'
278
- ]
279
-
280
- describe('FolderParser', () => {
281
- describe('getFolderData', () => {
282
- it('FolderParser should export getFolderData', async () => {
283
- expect(FolderParser).toHaveProperty('getFolderData')
284
- })
285
- it('getFolderData should return proper folder data', async () => {
286
- const folderData = FolderParser.getFolderData(sampleFolderRawData)
287
- expect(Array.isArray(folderData)).toBe(true)
288
- expect(folderData.length).toEqual(3)
289
- // Validate the first node
290
- expect(folderData[0].key).toEqual('path1')
291
- expect(folderData[0].title).toEqual('path1')
292
- expect(folderData[0].isLeaf).toBeTruthy()
293
- expect(folderData[0].extraInfo).toHaveProperty('type')
294
- expect(folderData[0].extraInfo.type).toEqual('file')
295
- expect(folderData[0].content).toHaveProperty('name')
296
- expect(folderData[0].content.name).toEqual('template1')
297
-
298
- // Validate the second node
299
- expect(folderData[1].key).toEqual('path2')
300
- expect(folderData[1].title).toEqual('path2')
301
- expect(folderData[1].isLeaf).toBeTruthy()
302
- expect(folderData[1].extraInfo).toHaveProperty('type')
303
- expect(folderData[1].extraInfo.type).toEqual('file')
304
- expect(folderData[1].content).toHaveProperty('name')
305
- expect(folderData[1].content.name).toEqual('template2')
306
-
307
- // Validate the third node
308
- expect(folderData[2].key).toEqual('path3')
309
- expect(folderData[2].title).toEqual('path3')
310
- expect(folderData[2].isLeaf).not.toBeTruthy()
311
- expect(folderData[2].extraInfo).toHaveProperty('type')
312
- expect(folderData[2].extraInfo.type).toEqual('folder')
313
- expect(folderData[2]).toHaveProperty('children')
314
- expect(Array.isArray(folderData[2].children)).toBe(true)
315
- expect(folderData[2].children.length).toEqual(5)
316
-
317
- // Validate the child nodes, here the order should be according to master.json file. So name4 comes first.
318
- const child1 = folderData[2].children[0]
319
- // Validate the third node child 1
320
- expect(child1.key).toEqual('path3/name4')
321
- expect(child1.title).toEqual('name4')
322
- expect(child1.isLeaf).toBeTruthy()
323
- expect(child1.extraInfo).toHaveProperty('type')
324
- expect(child1.extraInfo.type).toEqual('file')
325
- expect(child1.content).toHaveProperty('name')
326
- expect(child1.content.name).toEqual('template4')
327
-
328
- const child2 = folderData[2].children[1]
329
- // Validate the third node child 2
330
- expect(child2.key).toEqual('path3/name3')
331
- expect(child2.title).toEqual('name3')
332
- expect(child2.isLeaf).toBeTruthy()
333
- expect(child2.extraInfo).toHaveProperty('type')
334
- expect(child2.extraInfo.type).toEqual('file')
335
- expect(child2.content).toHaveProperty('name')
336
- expect(child2.content.name).toEqual('template3')
337
-
338
- const child3 = folderData[2].children[2]
339
- // Validate the third node child 3
340
- expect(child3.key).toEqual('path3/name1')
341
- expect(child3.title).toEqual('name1')
342
- expect(child3.isLeaf).toBeTruthy()
343
- expect(child3.extraInfo).toHaveProperty('type')
344
- expect(child3.extraInfo.type).toEqual('fileRef')
345
- })
346
- it('getFolderData should return proper folder data with multple subfolder levels', async () => {
347
- const folderData = FolderParser.getFolderData(sampleFolderRawDataWithMultipleFolderLevels)
348
- expect(Array.isArray(folderData)).toBe(true)
349
- expect(folderData.length).toEqual(2)
350
- // Validate the first node
351
- expect(folderData[0].key).toEqual('path1')
352
- expect(folderData[0].title).toEqual('path1')
353
- expect(folderData[0].isLeaf).toBeTruthy()
354
- expect(folderData[0].extraInfo).toHaveProperty('type')
355
- expect(folderData[0].extraInfo.type).toEqual('file')
356
- expect(folderData[0].content).toHaveProperty('name')
357
- expect(folderData[0].content.name).toEqual('template1')
358
-
359
- // Validate the second node
360
- expect(folderData[1].key).toEqual('path2')
361
- expect(folderData[1].title).toEqual('path2')
362
- expect(folderData[1].isLeaf).not.toBeTruthy()
363
- expect(folderData[1].extraInfo).toHaveProperty('type')
364
- expect(folderData[1].extraInfo.type).toEqual('folder')
365
- expect(folderData[1]).toHaveProperty('children')
366
- expect(Array.isArray(folderData[1].children)).toBe(true)
367
- expect(folderData[1].children.length).toEqual(3)
368
-
369
- // Validate the child nodes
370
- const child1 = folderData[1].children[0]
371
- // Validate the second node child 1
372
- expect(child1.key).toEqual('path2/subpath21')
373
- expect(child1.title).toEqual('subpath21')
374
- expect(child1.isLeaf).not.toBeTruthy()
375
- expect(child1.extraInfo).toHaveProperty('type')
376
- expect(child1.extraInfo.type).toEqual('folder')
377
- expect(child1).toHaveProperty('children')
378
-
379
- // Validate the sub child nodes
380
- const subChild1 = child1.children[0]
381
- // Validate the second node child 1
382
- expect(subChild1.key).toEqual('path2/subpath21/name2')
383
- expect(subChild1.title).toEqual('name2')
384
- expect(subChild1.isLeaf).toBeTruthy()
385
- expect(subChild1.extraInfo).toHaveProperty('type')
386
- expect(subChild1.extraInfo.type).toEqual('file')
387
- })
388
- })
389
-
390
- describe('getFolderData negative scenarios', () => {
391
- it('getFolderData should not throw any error when unknown type specified in master.json', async () => {
392
- const folderData = FolderParser.getFolderData(sampleWrongFolderRawDataWithWithUnknownType)
393
- expect(Array.isArray(folderData)).toBe(true)
394
- expect(folderData.length).toEqual(0)
395
- })
396
- })
397
-
398
- describe('getTestCases', () => {
399
- it('FolderParser should export getTestCases', async () => {
400
- expect(FolderParser).toHaveProperty('getTestCases')
401
- })
402
- it('getTestCases should return proper test cases', async () => {
403
- // First get the folderData
404
- const folderData = FolderParser.getFolderData(sampleFolderRawData)
405
- const testCases = FolderParser.getTestCases(folderData)
406
- expect(Array.isArray(testCases)).toBe(true)
407
- expect(testCases.length).toEqual(7)
408
- // Validate the first test case
409
- expect(testCases[0]).toHaveProperty('id')
410
- expect(testCases[0].id).toEqual(1)
411
- expect(testCases[0]).toHaveProperty('name')
412
- expect(testCases[0].name).toEqual('Test Case Name')
413
-
414
- // Validate the second test case
415
- expect(testCases[1]).toHaveProperty('id')
416
- expect(testCases[1].id).toEqual(1)
417
- expect(testCases[1]).toHaveProperty('name')
418
- expect(testCases[1].name).toEqual('Test Case Name')
419
- })
420
- it('getTestCases with selected files should return proper test cases', async () => {
421
- // First get the folderData
422
- const folderData = FolderParser.getFolderData(sampleFolderRawData)
423
- const testCases = FolderParser.getTestCases(folderData, sampleSelectedFiles)
424
- expect(Array.isArray(testCases)).toBe(true)
425
- expect(testCases.length).toEqual(1)
426
- // Validate the first test case
427
- expect(testCases[0]).toHaveProperty('id')
428
- expect(testCases[0].id).toEqual(1)
429
- expect(testCases[0]).toHaveProperty('name')
430
- expect(testCases[0].name).toEqual('Test Case Name')
431
- })
432
- it('getTestCases with selected files and selectedLabels should return proper test cases', async () => {
433
- // First get the folderData
434
- const folderData = FolderParser.getFolderData(sampleFolderRawDataWithLabels)
435
- const testCases = FolderParser.getTestCases(folderData, null, sampleSelectedLabels)
436
- expect(Array.isArray(testCases)).toBe(true)
437
- expect(testCases.length).toEqual(1)
438
- // Validate the first test case
439
- expect(testCases[0]).toHaveProperty('id')
440
- expect(testCases[0].id).toEqual(1)
441
- expect(testCases[0]).toHaveProperty('name')
442
- expect(testCases[0].name).toEqual('Test Case Name')
443
- })
444
- })
445
-
446
- describe('sequenceTestCases', () => {
447
- it('FolderParser should export sequenceTestCases', async () => {
448
- expect(FolderParser).toHaveProperty('sequenceTestCases')
449
- })
450
- it('sequenceTestCases should return the same number of test cases', async () => {
451
- // First get the folderData
452
- const folderData = FolderParser.getFolderData(sampleFolderRawData)
453
- // Get the test cases
454
- const testCases = FolderParser.getTestCases(folderData)
455
- // Sequence them
456
- FolderParser.sequenceTestCases(testCases)
457
- // Validate the modified test cases
458
- expect(Array.isArray(testCases)).toBe(true)
459
- expect(testCases.length).toEqual(7)
460
- })
461
- })
462
-
463
- describe('getTestCases negative scenarios', () => {
464
- it('getTestCases should not throw error when a template content is supplied without test cases', async () => {
465
- // First get the folderData
466
- const folderData = FolderParser.getFolderData(sampleWrongFolderRawDataWithoutTestCases)
467
- const testCases = FolderParser.getTestCases(folderData)
468
- expect(Array.isArray(testCases)).toBe(true)
469
- expect(testCases.length).toEqual(0)
470
- })
471
- it('getTestCases should not throw error when a file ref is provided with a path not exists', async () => {
472
- // First get the folderData
473
- const folderData = FolderParser.getFolderData(sampleWrongFolderRawDataWithWrongFileRef)
474
- const testCases = FolderParser.getTestCases(folderData)
475
- expect(Array.isArray(testCases)).toBe(true)
476
- expect(testCases.length).toEqual(0)
477
- })
478
- it('getTestCases should not throw error when a file ref is provided with wrong relative path', async () => {
479
- // First get the folderData
480
- const folderData = FolderParser.getFolderData(sampleWrongFolderRawDataWithFileRefWrongRelativePath)
481
- const testCases = FolderParser.getTestCases(folderData)
482
- expect(Array.isArray(testCases)).toBe(true)
483
- expect(testCases.length).toEqual(0)
484
- })
485
- it('getTestCases with wrong selected files should not return any test cases', async () => {
486
- // First get the folderData
487
- const folderData = FolderParser.getFolderData(sampleFolderRawData)
488
- const testCases = FolderParser.getTestCases(folderData, sampleSelectedFilesWrongPath)
489
- expect(Array.isArray(testCases)).toBe(true)
490
- expect(testCases.length).toEqual(0)
491
- })
492
- it('getTestCases with wrong folderData should not return any test cases', async () => {
493
- // First get the folderData
494
- const folderData = FolderParser.getFolderData(sampleFolderRawData)
495
- // Chnage the folder data
496
- folderData[0].title = 'wrongtitle'
497
- const testCases = FolderParser.getTestCases(folderData, ['path3/name1'])
498
- expect(Array.isArray(testCases)).toBe(true)
499
- expect(testCases.length).toEqual(0)
500
- })
501
- })
502
- })