rooibos-roku 4.4.2

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -0
  3. package/dist/lib/framework/BaseTestReporter.bs +27 -0
  4. package/dist/lib/framework/BaseTestSuite.bs +2131 -0
  5. package/dist/lib/framework/CommonUtils.bs +732 -0
  6. package/dist/lib/framework/ConsoleTestReporter.bs +200 -0
  7. package/dist/lib/framework/Coverage.bs +51 -0
  8. package/dist/lib/framework/Matchers.bs +28 -0
  9. package/dist/lib/framework/Rooibos.bs +83 -0
  10. package/dist/lib/framework/RooibosScene.xml +50 -0
  11. package/dist/lib/framework/RuntimeConfig.bs +20 -0
  12. package/dist/lib/framework/Stats.bs +46 -0
  13. package/dist/lib/framework/Test.bs +109 -0
  14. package/dist/lib/framework/TestGroup.bs +109 -0
  15. package/dist/lib/framework/TestResult.bs +74 -0
  16. package/dist/lib/framework/TestRunner.bs +187 -0
  17. package/dist/lib/framework/Utils.bs +63 -0
  18. package/dist/lib/framework/unused/CodeCoverage.brs +35 -0
  19. package/dist/lib/framework/unused/CodeCoverage.xml +13 -0
  20. package/dist/lib/framework/unused/CodeCoverageSupport.brs +56 -0
  21. package/dist/lib/rooibos/Annotation.js +187 -0
  22. package/dist/lib/rooibos/Annotation.js.map +1 -0
  23. package/dist/lib/rooibos/CodeCoverageProcessor.js +114 -0
  24. package/dist/lib/rooibos/CodeCoverageProcessor.js.map +1 -0
  25. package/dist/lib/rooibos/CodeCoverageProcessor.spec.js +62 -0
  26. package/dist/lib/rooibos/CodeCoverageProcessor.spec.js.map +1 -0
  27. package/dist/lib/rooibos/CodeCoverageType.js +11 -0
  28. package/dist/lib/rooibos/CodeCoverageType.js.map +1 -0
  29. package/dist/lib/rooibos/FileFactory.js +92 -0
  30. package/dist/lib/rooibos/FileFactory.js.map +1 -0
  31. package/dist/lib/rooibos/RawCodeStatement.js +21 -0
  32. package/dist/lib/rooibos/RawCodeStatement.js.map +1 -0
  33. package/dist/lib/rooibos/RooibosConfig.js +11 -0
  34. package/dist/lib/rooibos/RooibosConfig.js.map +1 -0
  35. package/dist/lib/rooibos/RooibosSession.js +151 -0
  36. package/dist/lib/rooibos/RooibosSession.js.map +1 -0
  37. package/dist/lib/rooibos/RooibosSessionInfo.js +181 -0
  38. package/dist/lib/rooibos/RooibosSessionInfo.js.map +1 -0
  39. package/dist/lib/rooibos/TestCase.js +65 -0
  40. package/dist/lib/rooibos/TestCase.js.map +1 -0
  41. package/dist/lib/rooibos/TestGroup.js +86 -0
  42. package/dist/lib/rooibos/TestGroup.js.map +1 -0
  43. package/dist/lib/rooibos/TestSuite.js +118 -0
  44. package/dist/lib/rooibos/TestSuite.js.map +1 -0
  45. package/dist/lib/rooibos/TestSuiteBuilder.js +192 -0
  46. package/dist/lib/rooibos/TestSuiteBuilder.js.map +1 -0
  47. package/dist/lib/rooibos/TestSuiteBuilder.spec.js +1126 -0
  48. package/dist/lib/rooibos/TestSuiteBuilder.spec.js.map +1 -0
  49. package/dist/lib/rooibos/Utils.js +173 -0
  50. package/dist/lib/rooibos/Utils.js.map +1 -0
  51. package/dist/lib/utils/Diagnostics.js +116 -0
  52. package/dist/lib/utils/Diagnostics.js.map +1 -0
  53. package/dist/lib/utils/testHelpers.spec.js +24 -0
  54. package/dist/lib/utils/testHelpers.spec.js.map +1 -0
  55. package/dist/plugin.js +116 -0
  56. package/dist/plugin.js.map +1 -0
  57. package/package.json +110 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestSuiteBuilder.js","sourceRoot":"","sources":["../../../src/lib/rooibos/TestSuiteBuilder.ts"],"names":[],"mappings":";;;AAIA,mDAEwB;AAExB,2CAAwC;AAExC,6CAAiE;AAEjE,yCAAsC;AACtC,2CAAwC;AAExC,sDAY8B;AAG9B,MAAa,gBAAgB;IACzB,YAAmB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAC1C,CAAC;IAQ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AAC;SAEf;aAAM,IAAI,cAAc,KAAK,CAAC,EAAE;YAC7B,IAAI,YAAY,KAAK,CAAC,EAAE;gBACpB,IAAI,CAAC,YAAY,CAAC,WAAW,CACzB,IAAI,mBAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CACrH,CAAC;aACL;iBAAM;gBACH,+CAAiC,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;aACrF;YACD,OAAO,IAAI,CAAC;SACf;aAAM;YACH,2CAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;SAC1D;IACL,CAAC;CACJ;AArMD,4CAqMC"}
@@ -0,0 +1,1126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const chai = require("chai");
4
+ // eslint-disable-next-line
5
+ const chai_1 = require("chai");
6
+ const TestSuiteBuilder_1 = require("./TestSuiteBuilder");
7
+ const brighterscript_1 = require("brighterscript");
8
+ const RooibosSession_1 = require("./RooibosSession");
9
+ const FileFactory_1 = require("./FileFactory");
10
+ // eslint-disable-next-line
11
+ const chaiSubset = require('chai-subset');
12
+ chai.use(chaiSubset);
13
+ let program;
14
+ let fileFactory;
15
+ let programBuilder;
16
+ let session;
17
+ let testSuiteBuilder;
18
+ describe('TestSuiteBuilder tests ', () => {
19
+ beforeEach(() => {
20
+ program = new brighterscript_1.Program({});
21
+ fileFactory = new FileFactory_1.FileFactory({});
22
+ programBuilder = new brighterscript_1.ProgramBuilder();
23
+ session = new RooibosSession_1.RooibosSession(programBuilder, fileFactory);
24
+ testSuiteBuilder = new TestSuiteBuilder_1.TestSuiteBuilder(session);
25
+ });
26
+ describe('No suites', () => {
27
+ it('no suite', () => {
28
+ let testSuite = createTestSuite('test1.bs', `
29
+ `);
30
+ chai_1.expect(testSuite).to.be.null;
31
+ });
32
+ it('no suite - namespace', () => {
33
+ let testSuite = createTestSuite('test1.bs', `namespace empty
34
+ end namespace
35
+ `);
36
+ chai_1.expect(testSuite).to.be.null;
37
+ });
38
+ it('no suite - namespace with funcs', () => {
39
+ let testSuite = createTestSuite('test1.bs', `namespace empty
40
+ function foo()
41
+ end function
42
+ end namespace
43
+ `);
44
+ chai_1.expect(testSuite).to.be.null;
45
+ });
46
+ it('no suite - namespace with class', () => {
47
+ let testSuite = createTestSuite('test1.bs', `namespace empty
48
+ class fooClass
49
+ end class
50
+ end namespace
51
+ `);
52
+ chai_1.expect(testSuite).to.be.null;
53
+ });
54
+ it('no suite - class', () => {
55
+ let testSuite = createTestSuite('test1.bs', `class fooClass
56
+ end class
57
+ `);
58
+ chai_1.expect(testSuite).to.be.null;
59
+ });
60
+ });
61
+ describe('Suite issues', () => {
62
+ it('duplicate suite name - different files', () => {
63
+ let ts = createTestSuite('test1.bs', `namespace Tests
64
+ @suite("Rooibos assertion tests")
65
+ class AssertionTests extends Rooibos.BaseTestSuite
66
+ @describe("group1")
67
+
68
+ @it("one")
69
+ function test_one()
70
+ end function
71
+ end class
72
+ end namespace
73
+ `);
74
+ assertSuite(ts, 1);
75
+ let testSuite2 = createTestSuite('test2.bs', `namespace Tests
76
+ @suite("Rooibos assertion tests")
77
+ class AssertionTests extends Rooibos.BaseTestSuite
78
+ @describe("group1")
79
+
80
+ @it("one")
81
+ function test_one()
82
+ end function
83
+ end class
84
+ end namespace
85
+ `);
86
+ assertSuiteError(testSuite2);
87
+ chai_1.expect(ts.isValid).to.be.false;
88
+ });
89
+ it('duplicate suite name - same file', () => {
90
+ let ts = createTestSuite('test1.bs', `namespace Tests
91
+ @suite("Rooibos assertion tests")
92
+ class AssertionTests extends Rooibos.BaseTestSuite
93
+ @describe("group1")
94
+
95
+ @it("one")
96
+ function test_one()
97
+ end function
98
+ end class
99
+ @suite("Rooibos assertion tests")
100
+ class AssertionTests extends Rooibos.BaseTestSuite
101
+ @describe("group1")
102
+
103
+ @it("one")
104
+ function test_one()
105
+ end function
106
+ end class
107
+ end namespace
108
+ `);
109
+ assertSuiteError(ts);
110
+ });
111
+ it('duplicate group', () => {
112
+ let ts = createTestSuite('test1.bs', `namespace Tests
113
+ @suite("Rooibos assertion tests")
114
+ class AssertionTests extends Rooibos.BaseTestSuite
115
+ @describe("group1")
116
+
117
+ @it("one")
118
+ function test_one()
119
+ end function
120
+
121
+ @describe("group1")
122
+
123
+ @it("two")
124
+ function test_Two()
125
+ end function
126
+ end class
127
+ end namespace
128
+ `);
129
+ assertSuiteError(ts);
130
+ });
131
+ it('duplicate test', () => {
132
+ let ts = createTestSuite('test1.bs', `namespace Tests
133
+ @suite("Rooibos assertion tests")
134
+ class AssertionTests extends Rooibos.BaseTestSuite
135
+ @describe("group1")
136
+
137
+ @it("one")
138
+ function test_one()
139
+ end function
140
+
141
+ @it("one")
142
+ function test_Two()
143
+ end function
144
+ end class
145
+ end namespace
146
+ `);
147
+ assertSuiteError(ts);
148
+ });
149
+ });
150
+ describe('Has valid suites', () => {
151
+ it('class with 1 group, 1 test', () => {
152
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
153
+
154
+ @suite("Rooibos assertion tests")
155
+ class AssertionTests extends Rooibos.BaseTestSuite
156
+
157
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
158
+ @describe("group1")
159
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
160
+
161
+ @it("one")
162
+ function test_one()
163
+ end function
164
+ end class
165
+ end namespace
166
+ `);
167
+ assertSuite(testSuite, 1);
168
+ assertGroupCount(testSuite, 0, 1);
169
+ });
170
+ });
171
+ it('class with 1 group 2 tests', () => {
172
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
173
+
174
+ @suite("Rooibos assertion tests")
175
+ class AssertionTests extends Rooibos.BaseTestSuite
176
+
177
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
178
+ @describe("group1")
179
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
180
+
181
+ @it("one")
182
+ function test_one()
183
+ end function
184
+
185
+ @it("two")
186
+ function test_two()
187
+ end function
188
+ end class
189
+ end namespace
190
+ `);
191
+ assertSuite(testSuite, 1);
192
+ assertGroupCount(testSuite, 0, 2);
193
+ });
194
+ it('class with 2 group, 1 test each', () => {
195
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
196
+
197
+ @suite("Rooibos assertion tests")
198
+ class AssertionTests extends Rooibos.BaseTestSuite
199
+
200
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
201
+ @describe("group1")
202
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
203
+
204
+ @it("one")
205
+ function test_one()
206
+ end function
207
+
208
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
209
+ @describe("group2")
210
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
211
+
212
+ @it("two")
213
+ function test_two()
214
+ end function
215
+ end class
216
+ end namespace
217
+ `);
218
+ assertSuite(testSuite, 2);
219
+ assertGroupCount(testSuite, 0, 1);
220
+ assertGroupCount(testSuite, 1, 1);
221
+ });
222
+ it('class with 2 group, 1 test each - concise syntax', () => {
223
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
224
+
225
+ @suite("Rooibos assertion tests")
226
+ class AssertionTests extends Rooibos.BaseTestSuite
227
+
228
+ @describe("group1")
229
+
230
+ @it("one")
231
+ function test_one()
232
+ end function
233
+
234
+ @describe("group2")
235
+
236
+ @it("two")
237
+ function test_two()
238
+ end function
239
+ end class
240
+ end namespace
241
+ `);
242
+ assertSuite(testSuite, 2);
243
+ assertGroupCount(testSuite, 0, 1);
244
+ assertGroupCount(testSuite, 1, 1);
245
+ });
246
+ it('Valid params', () => {
247
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
248
+
249
+ @suite("Rooibos assertion tests")
250
+ class AssertionTests extends Rooibos.BaseTestSuite
251
+
252
+ @describe("group1")
253
+
254
+ @it("one")
255
+ @params(true, "one")
256
+ function test_one(v1, v2)
257
+ end function
258
+ end class
259
+ end namespace
260
+ `);
261
+ assertSuite(testSuite, 1);
262
+ assertGroupCount(testSuite, 0, 1);
263
+ assertParamTestCase(testSuite, 0, 0, 0);
264
+ });
265
+ it('Valid params 2 params', () => {
266
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
267
+
268
+ @suite("Rooibos assertion tests")
269
+ class AssertionTests extends Rooibos.BaseTestSuite
270
+
271
+ @describe("group1")
272
+
273
+ @it("one")
274
+ @params(true, "one")
275
+ @params(true, "one")
276
+ function test_one(v1, v2)
277
+ end function
278
+ end class
279
+ end namespace
280
+ `);
281
+ assertSuite(testSuite, 1);
282
+ assertGroupCount(testSuite, 0, 2);
283
+ assertParamTestCase(testSuite, 0, 0, 0);
284
+ assertParamTestCase(testSuite, 0, 1, 1);
285
+ });
286
+ it('Valid params 5 params', () => {
287
+ let testSuite = createTestSuite('test1.bs', `namespace Tests
288
+
289
+ @suite("Rooibos assertion tests")
290
+ class AssertionTests extends Rooibos.BaseTestSuite
291
+
292
+ @describe("group1")
293
+
294
+ @it("one")
295
+ @params(true, "1")
296
+ @params(true, "2")
297
+ @params(true, "3")
298
+ @params(true, "4")
299
+ @params(true, "5")
300
+ function test_one(v1, v2)
301
+ end function
302
+ end class
303
+ end namespace
304
+ `);
305
+ assertSuite(testSuite, 1);
306
+ assertGroupCount(testSuite, 0, 5);
307
+ assertParamTestCase(testSuite, 0, 0, 0);
308
+ assertParamTestCase(testSuite, 0, 1, 1);
309
+ assertParamTestCase(testSuite, 0, 2, 2);
310
+ assertParamTestCase(testSuite, 0, 3, 3);
311
+ assertParamTestCase(testSuite, 0, 4, 4);
312
+ });
313
+ describe('only tags', () => {
314
+ it('only suite', () => {
315
+ let ts = createTestSuite('test1.bs', `namespace Tests
316
+ @only
317
+ @suite("Rooibos assertion tests")
318
+ class AssertionTests extends Rooibos.BaseTestSuite
319
+ @describe("group1")
320
+
321
+ @it("one")
322
+ function test_one()
323
+ end function
324
+
325
+ @it("two")
326
+ function test_Two()
327
+ end function
328
+ end class
329
+ end namespace
330
+ `);
331
+ assertSuite(ts, 1);
332
+ assertGroupCount(ts, 0, 2);
333
+ chai_1.expect(ts.isSolo).to.be.true;
334
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.false;
335
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.false;
336
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.false;
337
+ chai_1.expect(ts.hasSoloTests).to.be.false;
338
+ chai_1.expect(ts.hasSoloGroups).to.be.false;
339
+ });
340
+ it('only group', () => {
341
+ let ts = createTestSuite('test1.bs', `namespace Tests
342
+ @suite("Rooibos assertion tests")
343
+ class AssertionTests extends Rooibos.BaseTestSuite
344
+ @only
345
+ @describe("group1")
346
+
347
+ @it("one")
348
+ function test_one()
349
+ end function
350
+
351
+ @it("two")
352
+ function test_Two()
353
+ end function
354
+ end class
355
+ end namespace
356
+ `);
357
+ assertSuite(ts, 1);
358
+ assertGroupCount(ts, 0, 2);
359
+ chai_1.expect(ts.isSolo).to.be.false;
360
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.true;
361
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.false;
362
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.false;
363
+ chai_1.expect(ts.hasSoloTests).to.be.false;
364
+ chai_1.expect(ts.hasSoloGroups).to.be.true;
365
+ });
366
+ it('only test', () => {
367
+ let ts = createTestSuite('test1.bs', `namespace Tests
368
+ @suite("Rooibos assertion tests")
369
+ class AssertionTests extends Rooibos.BaseTestSuite
370
+ @describe("group1")
371
+
372
+ @only
373
+ @it("one")
374
+ function test_one()
375
+ end function
376
+
377
+ @it("two")
378
+ function test_Two()
379
+ end function
380
+ end class
381
+ end namespace
382
+ `);
383
+ assertSuite(ts, 1);
384
+ assertGroupCount(ts, 0, 2);
385
+ chai_1.expect(ts.isSolo).to.be.false;
386
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.false;
387
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
388
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.false;
389
+ chai_1.expect(ts.hasSoloTests).to.be.true;
390
+ chai_1.expect(ts.hasSoloGroups).to.be.false;
391
+ });
392
+ it('two tests', () => {
393
+ let ts = createTestSuite('test1.bs', `namespace Tests
394
+ @suite("Rooibos assertion tests")
395
+ class AssertionTests extends Rooibos.BaseTestSuite
396
+ @describe("group1")
397
+
398
+ @only
399
+ @it("one")
400
+ function test_one()
401
+ end function
402
+
403
+ @only
404
+ @it("two")
405
+ function test_Two()
406
+ end function
407
+ end class
408
+ end namespace
409
+ `);
410
+ assertSuite(ts, 1);
411
+ assertGroupCount(ts, 0, 2);
412
+ chai_1.expect(ts.isSolo).to.be.false;
413
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.false;
414
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
415
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
416
+ chai_1.expect(ts.hasSoloTests).to.be.true;
417
+ chai_1.expect(ts.hasSoloGroups).to.be.false;
418
+ });
419
+ it('two tests and group', () => {
420
+ let ts = createTestSuite('test1.bs', `namespace Tests
421
+ @suite("Rooibos assertion tests")
422
+ class AssertionTests extends Rooibos.BaseTestSuite
423
+ @only
424
+ @describe("group1")
425
+
426
+ @only
427
+ @it("one")
428
+ function test_one()
429
+ end function
430
+
431
+ @only
432
+ @it("two")
433
+ function test_Two()
434
+ end function
435
+ end class
436
+ end namespace
437
+ `);
438
+ assertSuite(ts, 1);
439
+ assertGroupCount(ts, 0, 2);
440
+ chai_1.expect(ts.isSolo).to.be.false;
441
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.true;
442
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
443
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
444
+ chai_1.expect(ts.hasSoloTests).to.be.true;
445
+ chai_1.expect(ts.hasSoloGroups).to.be.true;
446
+ });
447
+ it('all', () => {
448
+ let ts = createTestSuite('test1.bs', `namespace Tests
449
+ @only
450
+ @suite("Rooibos assertion tests")
451
+ class AssertionTests extends Rooibos.BaseTestSuite
452
+ @only
453
+ @describe("group1")
454
+
455
+ @only
456
+ @it("one")
457
+ function test_one()
458
+ end function
459
+
460
+ @only
461
+ @it("two")
462
+ function test_Two()
463
+ end function
464
+ end class
465
+ end namespace
466
+ `);
467
+ assertSuite(ts, 1);
468
+ assertGroupCount(ts, 0, 2);
469
+ chai_1.expect(ts.isSolo).to.be.true;
470
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.true;
471
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
472
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
473
+ chai_1.expect(ts.hasSoloTests).to.be.true;
474
+ chai_1.expect(ts.hasSoloGroups).to.be.true;
475
+ });
476
+ it('two groups', () => {
477
+ let ts = createTestSuite('test1.bs', `namespace Tests
478
+ @only
479
+ @suite("Rooibos assertion tests")
480
+ class AssertionTests extends Rooibos.BaseTestSuite
481
+ @only
482
+ @describe("group1")
483
+
484
+ @only
485
+ @it("one")
486
+ function test_one()
487
+ end function
488
+
489
+ @only
490
+ @it("two")
491
+ function test_Two()
492
+ end function
493
+ @describe("group2")
494
+
495
+ @it("one")
496
+ function test_g2_one()
497
+ end function
498
+ end class
499
+ end namespace
500
+ `);
501
+ assertSuite(ts, 2);
502
+ assertGroupCount(ts, 0, 2);
503
+ chai_1.expect(ts.isSolo).to.be.true;
504
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.true;
505
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
506
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
507
+ assertGroupCount(ts, 1, 1);
508
+ chai_1.expect(getGroup(ts, 1).isSolo).to.be.false;
509
+ chai_1.expect(getTestCase(ts, 1, 0).isSolo).to.be.false;
510
+ chai_1.expect(ts.hasSoloTests).to.be.true;
511
+ chai_1.expect(ts.hasSoloGroups).to.be.true;
512
+ });
513
+ it('mixup', () => {
514
+ let ts = createTestSuite('test1.bs', `namespace Tests
515
+ @only
516
+ @suite("Rooibos assertion tests")
517
+ class AssertionTests extends Rooibos.BaseTestSuite
518
+ @only
519
+ @describe("group1")
520
+
521
+ @it("one")
522
+ function test_one()
523
+ end function
524
+
525
+ @only
526
+ @it("two")
527
+ function test_Two()
528
+ end function
529
+ @describe("group2")
530
+
531
+ @only
532
+ @it("one")
533
+ function test_g2_one()
534
+ end function
535
+ end class
536
+ end namespace
537
+ `);
538
+ assertSuite(ts, 2);
539
+ assertGroupCount(ts, 0, 2);
540
+ chai_1.expect(ts.isSolo).to.be.true;
541
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.true;
542
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.false;
543
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
544
+ assertGroupCount(ts, 1, 1);
545
+ chai_1.expect(getGroup(ts, 1).isSolo).to.be.false;
546
+ chai_1.expect(getTestCase(ts, 1, 0).isSolo).to.be.true;
547
+ chai_1.expect(ts.hasSoloTests).to.be.true;
548
+ chai_1.expect(ts.hasSoloGroups).to.be.true;
549
+ });
550
+ it('only on param block', () => {
551
+ let ts = createTestSuite('test1.bs', `namespace Tests
552
+ @suite("Rooibos assertion tests")
553
+ class AssertionTests extends Rooibos.BaseTestSuite
554
+ @describe("group1")
555
+
556
+ @Only
557
+ @it("one")
558
+ @params("1")
559
+ @params("2")
560
+ @params("3")
561
+ function test_one(value)
562
+ end function
563
+
564
+ @it("two")
565
+ function test_Two()
566
+ end function
567
+ end class
568
+ end namespace
569
+ `);
570
+ assertSuite(ts, 1);
571
+ assertGroupCount(ts, 0, 4);
572
+ chai_1.expect(ts.isSolo).to.be.false;
573
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.false;
574
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
575
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
576
+ chai_1.expect(getTestCase(ts, 0, 2).isSolo).to.be.true;
577
+ chai_1.expect(getTestCase(ts, 0, 3).isSolo).to.be.false;
578
+ chai_1.expect(ts.hasSoloTests).to.be.true;
579
+ chai_1.expect(ts.hasSoloGroups).to.be.false;
580
+ });
581
+ it('onlyparams', () => {
582
+ let ts = createTestSuite('test1.bs', `namespace Tests
583
+ @suite("Rooibos assertion tests")
584
+ class AssertionTests extends Rooibos.BaseTestSuite
585
+ @describe("group1")
586
+
587
+ @it("one")
588
+ @params("1")
589
+ @onlyParams("2")
590
+ @params("3")
591
+ function test_one(value)
592
+ end function
593
+
594
+ @it("two")
595
+ function test_Two()
596
+ end function
597
+ end class
598
+ end namespace
599
+ `);
600
+ assertSuite(ts, 1);
601
+ assertGroupCount(ts, 0, 4);
602
+ chai_1.expect(ts.isSolo).to.be.false;
603
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.false;
604
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.false;
605
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.true;
606
+ chai_1.expect(getTestCase(ts, 0, 2).isSolo).to.be.false;
607
+ chai_1.expect(getTestCase(ts, 0, 3).isSolo).to.be.false;
608
+ chai_1.expect(ts.hasSoloTests).to.be.true;
609
+ chai_1.expect(ts.hasSoloGroups).to.be.false;
610
+ });
611
+ it('onlyparams 2', () => {
612
+ let ts = createTestSuite('test1.bs', `namespace Tests
613
+ @suite("Rooibos assertion tests")
614
+ class AssertionTests extends Rooibos.BaseTestSuite
615
+ @describe("group1")
616
+
617
+ @it("one")
618
+ @onlyParams("1")
619
+ @params("2")
620
+ @onlyParams("3")
621
+ function test_one(value)
622
+ end function
623
+
624
+ @it("two")
625
+ function test_Two()
626
+ end function
627
+ end class
628
+ end namespace
629
+ `);
630
+ assertSuite(ts, 1);
631
+ assertGroupCount(ts, 0, 4);
632
+ chai_1.expect(ts.isSolo).to.be.false;
633
+ chai_1.expect(getGroup(ts, 0).isSolo).to.be.false;
634
+ chai_1.expect(getTestCase(ts, 0, 0).isSolo).to.be.true;
635
+ chai_1.expect(getTestCase(ts, 0, 1).isSolo).to.be.false;
636
+ chai_1.expect(getTestCase(ts, 0, 2).isSolo).to.be.true;
637
+ chai_1.expect(getTestCase(ts, 0, 3).isSolo).to.be.false;
638
+ chai_1.expect(ts.hasSoloTests).to.be.true;
639
+ chai_1.expect(ts.hasSoloGroups).to.be.false;
640
+ });
641
+ });
642
+ describe('ignore tags', () => {
643
+ it('ignore suite', () => {
644
+ let ts = createTestSuite('test1.bs', `namespace Tests
645
+ @ignore
646
+ @suite("Rooibos assertion tests")
647
+ class AssertionTests extends Rooibos.BaseTestSuite
648
+ @describe("group1")
649
+
650
+ @it("one")
651
+ function test_one()
652
+ end function
653
+
654
+ @it("two")
655
+ function test_Two()
656
+ end function
657
+ end class
658
+ end namespace
659
+ `);
660
+ assertSuite(ts, 1);
661
+ assertGroupCount(ts, 0, 2);
662
+ chai_1.expect(ts.isIgnored).to.be.true;
663
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.false;
664
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.false;
665
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.false;
666
+ chai_1.expect(ts.hasIgnoredTests).to.be.false;
667
+ });
668
+ it('ignore group', () => {
669
+ let ts = createTestSuite('test1.bs', `namespace Tests
670
+ @suite("Rooibos assertion tests")
671
+ class AssertionTests extends Rooibos.BaseTestSuite
672
+ @ignore
673
+ @describe("group1")
674
+
675
+ @it("one")
676
+ function test_one()
677
+ end function
678
+
679
+ @it("two")
680
+ function test_Two()
681
+ end function
682
+ end class
683
+ end namespace
684
+ `);
685
+ assertSuite(ts, 1);
686
+ assertGroupCount(ts, 0, 2);
687
+ chai_1.expect(ts.isIgnored).to.be.false;
688
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.true;
689
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.false;
690
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.false;
691
+ chai_1.expect(ts.hasIgnoredTests).to.be.false;
692
+ });
693
+ it('ignore test', () => {
694
+ let ts = createTestSuite('test1.bs', `namespace Tests
695
+ @suite("Rooibos assertion tests")
696
+ class AssertionTests extends Rooibos.BaseTestSuite
697
+ @describe("group1")
698
+
699
+ @ignore
700
+ @it("one")
701
+ function test_one()
702
+ end function
703
+
704
+ @it("two")
705
+ function test_Two()
706
+ end function
707
+ end class
708
+ end namespace
709
+ `);
710
+ assertSuite(ts, 1);
711
+ assertGroupCount(ts, 0, 2);
712
+ chai_1.expect(ts.isIgnored).to.be.false;
713
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.false;
714
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
715
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
716
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.false;
717
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
718
+ });
719
+ it('two tests', () => {
720
+ let ts = createTestSuite('test1.bs', `namespace Tests
721
+ @suite("Rooibos assertion tests")
722
+ class AssertionTests extends Rooibos.BaseTestSuite
723
+ @describe("group1")
724
+
725
+ @ignore
726
+ @it("one")
727
+ function test_one()
728
+ end function
729
+
730
+ @ignore
731
+ @it("two")
732
+ function test_Two()
733
+ end function
734
+ end class
735
+ end namespace
736
+ `);
737
+ assertSuite(ts, 1);
738
+ assertGroupCount(ts, 0, 2);
739
+ chai_1.expect(ts.isIgnored).to.be.false;
740
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.false;
741
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
742
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
743
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
744
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
745
+ });
746
+ it('two tests and group', () => {
747
+ let ts = createTestSuite('test1.bs', `namespace Tests
748
+ @suite("Rooibos assertion tests")
749
+ class AssertionTests extends Rooibos.BaseTestSuite
750
+ @ignore
751
+ @describe("group1")
752
+
753
+ @ignore
754
+ @it("one")
755
+ function test_one()
756
+ end function
757
+
758
+ @ignore
759
+ @it("two")
760
+ function test_Two()
761
+ end function
762
+ end class
763
+ end namespace
764
+ `);
765
+ assertSuite(ts, 1);
766
+ assertGroupCount(ts, 0, 2);
767
+ chai_1.expect(ts.isIgnored).to.be.false;
768
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.true;
769
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
770
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
771
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
772
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
773
+ });
774
+ it('all', () => {
775
+ let ts = createTestSuite('test1.bs', `namespace Tests
776
+ @ignore
777
+ @suite("Rooibos assertion tests")
778
+ class AssertionTests extends Rooibos.BaseTestSuite
779
+ @ignore
780
+ @describe("group1")
781
+
782
+ @ignore
783
+ @it("one")
784
+ function test_one()
785
+ end function
786
+
787
+ @ignore
788
+ @it("two")
789
+ function test_Two()
790
+ end function
791
+ end class
792
+ end namespace
793
+ `);
794
+ assertSuite(ts, 1);
795
+ assertGroupCount(ts, 0, 2);
796
+ chai_1.expect(ts.isIgnored).to.be.true;
797
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.true;
798
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
799
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
800
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
801
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
802
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
803
+ });
804
+ it('two groups', () => {
805
+ let ts = createTestSuite('test1.bs', `namespace Tests
806
+ @ignore
807
+ @suite("Rooibos assertion tests")
808
+ class AssertionTests extends Rooibos.BaseTestSuite
809
+ @ignore
810
+ @describe("group1")
811
+
812
+ @ignore
813
+ @it("one")
814
+ function test_one()
815
+ end function
816
+
817
+ @ignore
818
+ @it("two")
819
+ function test_Two()
820
+ end function
821
+ @describe("group2")
822
+
823
+ @it("one")
824
+ function test_g2_one()
825
+ end function
826
+ end class
827
+ end namespace
828
+ `);
829
+ assertSuite(ts, 2);
830
+ assertGroupCount(ts, 0, 2);
831
+ chai_1.expect(ts.isIgnored).to.be.true;
832
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.true;
833
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
834
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
835
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
836
+ assertGroupCount(ts, 1, 1);
837
+ chai_1.expect(getGroup(ts, 1).isIgnored).to.be.false;
838
+ chai_1.expect(getGroup(ts, 1).hasIgnoredTests).to.be.false;
839
+ chai_1.expect(getTestCase(ts, 1, 0).isIgnored).to.be.false;
840
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
841
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
842
+ });
843
+ it('mixup', () => {
844
+ let ts = createTestSuite('test1.bs', `namespace Tests
845
+ @ignore
846
+ @suite("Rooibos assertion tests")
847
+ class AssertionTests extends Rooibos.BaseTestSuite
848
+ @ignore
849
+ @describe("group1")
850
+
851
+ @it("one")
852
+ function test_one()
853
+ end function
854
+
855
+ @ignore
856
+ @it("two")
857
+ function test_Two()
858
+ end function
859
+ @describe("group2")
860
+
861
+ @ignore
862
+ @it("one")
863
+ function test_g2_one()
864
+ end function
865
+ end class
866
+ end namespace
867
+ `);
868
+ assertSuite(ts, 2);
869
+ assertGroupCount(ts, 0, 2);
870
+ chai_1.expect(ts.isIgnored).to.be.true;
871
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.true;
872
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
873
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.false;
874
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
875
+ assertGroupCount(ts, 1, 1);
876
+ chai_1.expect(getGroup(ts, 1).hasIgnoredTests).to.be.true;
877
+ chai_1.expect(getGroup(ts, 1).isIgnored).to.be.false;
878
+ chai_1.expect(getTestCase(ts, 1, 0).isIgnored).to.be.true;
879
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
880
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
881
+ });
882
+ it('ignore on param block', () => {
883
+ let ts = createTestSuite('test1.bs', `namespace Tests
884
+ @suite("Rooibos assertion tests")
885
+ class AssertionTests extends Rooibos.BaseTestSuite
886
+ @describe("group1")
887
+
888
+ @ignore
889
+ @it("one")
890
+ @params("1")
891
+ @params("2")
892
+ @params("3")
893
+ function test_one(value)
894
+ end function
895
+
896
+ @it("two")
897
+ function test_Two()
898
+ end function
899
+ end class
900
+ end namespace
901
+ `);
902
+ assertSuite(ts, 1);
903
+ assertGroupCount(ts, 0, 4);
904
+ chai_1.expect(ts.isIgnored).to.be.false;
905
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.false;
906
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
907
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
908
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
909
+ chai_1.expect(getTestCase(ts, 0, 2).isIgnored).to.be.true;
910
+ chai_1.expect(getTestCase(ts, 0, 3).isIgnored).to.be.false;
911
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
912
+ });
913
+ it('ignoreParams', () => {
914
+ let ts = createTestSuite('test1.bs', `namespace Tests
915
+ @suite("Rooibos assertion tests")
916
+ class AssertionTests extends Rooibos.BaseTestSuite
917
+ @describe("group1")
918
+
919
+ @it("one")
920
+ @params("1")
921
+ @ignoreParams("2")
922
+ @params("3")
923
+ function test_one(value)
924
+ end function
925
+
926
+ @it("two")
927
+ function test_Two()
928
+ end function
929
+ end class
930
+ end namespace
931
+ `);
932
+ assertSuite(ts, 1);
933
+ assertGroupCount(ts, 0, 4);
934
+ chai_1.expect(ts.isIgnored).to.be.false;
935
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.false;
936
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
937
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.false;
938
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.true;
939
+ chai_1.expect(getTestCase(ts, 0, 2).isIgnored).to.be.false;
940
+ chai_1.expect(getTestCase(ts, 0, 3).isIgnored).to.be.false;
941
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
942
+ });
943
+ it('ignoreParams 2', () => {
944
+ let ts = createTestSuite('test1.bs', `namespace Tests
945
+ @suite("Rooibos assertion tests")
946
+ class AssertionTests extends Rooibos.BaseTestSuite
947
+ @describe("group1")
948
+
949
+ @it("one")
950
+ @ignoreParams("1")
951
+ @params("2")
952
+ @ignoreParams("3")
953
+ function test_one(value)
954
+ end function
955
+
956
+ @it("two")
957
+ function test_Two()
958
+ end function
959
+ end class
960
+ end namespace
961
+ `);
962
+ assertSuite(ts, 1);
963
+ assertGroupCount(ts, 0, 4);
964
+ chai_1.expect(ts.isIgnored).to.be.false;
965
+ chai_1.expect(getGroup(ts, 0).isIgnored).to.be.false;
966
+ chai_1.expect(getGroup(ts, 0).hasIgnoredTests).to.be.true;
967
+ chai_1.expect(getTestCase(ts, 0, 0).isIgnored).to.be.true;
968
+ chai_1.expect(getTestCase(ts, 0, 1).isIgnored).to.be.false;
969
+ chai_1.expect(getTestCase(ts, 0, 2).isIgnored).to.be.true;
970
+ chai_1.expect(getTestCase(ts, 0, 3).isIgnored).to.be.false;
971
+ chai_1.expect(ts.hasIgnoredTests).to.be.true;
972
+ });
973
+ });
974
+ describe('params', () => {
975
+ it('simple params', () => {
976
+ let ts = createTestSuite('test1.bs', `namespace Tests
977
+ @suite("Rooibos assertion tests")
978
+ class AssertionTests extends Rooibos.BaseTestSuite
979
+ @describe("group1")
980
+
981
+ @it("one")
982
+ @params("1")
983
+ @params("2")
984
+ @params("3")
985
+ function test_one(value)
986
+ end function
987
+ end class
988
+ end namespace
989
+ `);
990
+ assertSuite(ts, 1);
991
+ assertGroupCount(ts, 0, 3);
992
+ });
993
+ it('2 params', () => {
994
+ let ts = createTestSuite('test1.bs', `namespace Tests
995
+ @suite("Rooibos assertion tests")
996
+ class AssertionTests extends Rooibos.BaseTestSuite
997
+ @describe("group1")
998
+
999
+ @it("one")
1000
+ @params("1", true)
1001
+ @params("2", false)
1002
+ @params("3", true)
1003
+ function test_one(value, arg2)
1004
+ end function
1005
+ end class
1006
+ end namespace
1007
+ `);
1008
+ assertSuite(ts, 1);
1009
+ assertGroupCount(ts, 0, 3);
1010
+ });
1011
+ });
1012
+ it('2 with url and chars', () => {
1013
+ let ts = createTestSuite('test1.bs', `namespace Tests
1014
+ @suite("Rooibos assertion tests")
1015
+ class AssertionTests extends Rooibos.BaseTestSuite
1016
+ @describe("group1")
1017
+
1018
+ @it("one")
1019
+ @params("http://google.com/thing", true)
1020
+ @params("#'_!!@#%", false)
1021
+ @params("3", true)
1022
+ function test_one(value, arg2)
1023
+ end function
1024
+ end class
1025
+ end namespace
1026
+ `);
1027
+ assertSuite(ts, 1);
1028
+ assertGroupCount(ts, 0, 3);
1029
+ });
1030
+ it('param mismatch -no params', () => {
1031
+ let ts = createTestSuite('test1.bs', `namespace Tests
1032
+ @suite("Rooibos assertion tests")
1033
+ class AssertionTests extends Rooibos.BaseTestSuite
1034
+ @describe("group1")
1035
+
1036
+ @it("one")
1037
+ function test_one(value, arg2)
1038
+ end function
1039
+ end class
1040
+ end namespace
1041
+ `);
1042
+ assertSuiteError(ts);
1043
+ });
1044
+ it('param mismatch -one', () => {
1045
+ let ts = createTestSuite('test1.bs', `namespace Tests
1046
+ @suite("Rooibos assertion tests")
1047
+ class AssertionTests extends Rooibos.BaseTestSuite
1048
+ @describe("group1")
1049
+
1050
+ @it("one")
1051
+ @params("http://google.com/thing")
1052
+ @params("#'_!!@#%", false)
1053
+ @params("3", true)
1054
+ function test_one(value, arg2)
1055
+ end function
1056
+ end class
1057
+ end namespace
1058
+ `);
1059
+ assertSuiteError(ts);
1060
+ });
1061
+ it('param mismatch -all', () => {
1062
+ let ts = createTestSuite('test1.bs', `namespace Tests
1063
+ @suite("Rooibos assertion tests")
1064
+ class AssertionTests extends Rooibos.BaseTestSuite
1065
+ @describe("group1")
1066
+
1067
+ @it("one")
1068
+ @params("http://google.com/thing", true)
1069
+ @params("#'_!!@#%", false)
1070
+ @params("3", true)
1071
+ function test_one(value)
1072
+ end function
1073
+ end class
1074
+ end namespace
1075
+ `);
1076
+ assertSuiteError(ts);
1077
+ });
1078
+ it('cannot parse', () => {
1079
+ let ts = createTestSuite('test1.bs', `namespace Tests
1080
+ @suite("Rooibos assertion tests")
1081
+ class AssertionTests extends Rooibos.BaseTestSuite
1082
+ @describe("group1")
1083
+
1084
+ @it("one")
1085
+ @params("http://google.com/thing", true ")
1086
+ @params("#'_!!@#%", false)
1087
+ @params("3", true)
1088
+ function test_one(value, value)
1089
+ end function
1090
+ end class
1091
+ end namespace
1092
+ `);
1093
+ assertSuiteError(ts);
1094
+ });
1095
+ });
1096
+ function assertSuite(testSuite, expectedGroups) {
1097
+ chai_1.expect(testSuite).to.not.be.null;
1098
+ chai_1.expect(testSuite.isValid).to.be.true;
1099
+ chai_1.expect(testSuite.getTestGroups()).to.have.lengthOf(expectedGroups);
1100
+ }
1101
+ function assertSuiteError(testSuite) {
1102
+ chai_1.expect(testSuite).to.not.be.null;
1103
+ chai_1.expect(testSuite.isValid).to.be.false;
1104
+ }
1105
+ function assertGroupCount(testSuite, groupIndex, expectedTests) {
1106
+ chai_1.expect(testSuite.getTestGroups()[groupIndex].getTestCases()).to.have.lengthOf(expectedTests);
1107
+ }
1108
+ function getTestCase(testSuite, groupIndex, testIndex) {
1109
+ let group = testSuite.getTestGroups()[groupIndex];
1110
+ return group.getTestCases()[testIndex];
1111
+ }
1112
+ function getGroup(testSuite, groupIndex) {
1113
+ return testSuite.getTestGroups()[groupIndex];
1114
+ }
1115
+ function assertParamTestCase(testSuite, groupIndex, testIndex, paramIndex = 0) {
1116
+ let testCase = getTestCase(testSuite, groupIndex, testIndex);
1117
+ chai_1.expect(testCase.isParamTest).to.be.true;
1118
+ chai_1.expect(testCase.paramTestIndex).to.equal(paramIndex);
1119
+ }
1120
+ function createTestSuite(path, text) {
1121
+ let file = new brighterscript_1.BrsFile(path, path, program);
1122
+ file.parse(text);
1123
+ let testSuites = testSuiteBuilder.processFile(file);
1124
+ return testSuites.length > 0 ? testSuites[0] : null;
1125
+ }
1126
+ //# sourceMappingURL=TestSuiteBuilder.spec.js.map