|
1 |
| -varexpect=require('chai').expect; |
2 |
| -vartask=require('../lib/build/parser/task').task; |
3 |
| -vartrim=require('../lib/build/parser/actions').trimCommandValue; |
| 1 | +const{expect}=require('chai'); |
| 2 | +const{task}=require('../lib/build/parser/task'); |
| 3 | +consttrim=require('../lib/build/parser/actions').trimCommandValue; |
4 | 4 |
|
5 |
| -varresult=function(){ |
6 |
| -return{ |
7 |
| -chapters:[{ |
8 |
| -pages:[{ |
9 |
| -tasks:[] |
10 |
| -}] |
11 |
| -}] |
12 |
| -}; |
13 |
| -}; |
14 |
| -varindex=function(){ |
15 |
| -return{ |
16 |
| -chapter:0, |
17 |
| -page:0, |
18 |
| -task:-1 |
19 |
| -}; |
20 |
| -}; |
| 5 | +constresult=()=>({ |
| 6 | +pages:[{ |
| 7 | +tasks:[] |
| 8 | +}] |
| 9 | +}); |
21 | 10 |
|
22 |
| -describe('@test',function(){ |
| 11 | +constindex=()=>({ |
| 12 | +page:0, |
| 13 | +task:-1 |
| 14 | +}); |
23 | 15 |
|
24 |
| -it('should take a single test file',function(){ |
25 |
| -varlines=['+ Task One','',"@test('path/to/test.js')"]; |
26 |
| -varnext=task(result(),lines,index()); |
27 |
| -varnextTask=next.chapters[0].pages[0].tasks[0]; |
| 16 | +describe('@test',()=>{ |
| 17 | + |
| 18 | +it('should take a single test file',()=>{ |
| 19 | +constlines=['+ Task One','',"@test('path/to/test.js')"]; |
| 20 | +constnext=task({result:result(), lines,index:index()}); |
| 21 | +constnextTask=next.pages[0].tasks[0]; |
28 | 22 | expect(nextTask).to.deep.equal({
|
29 | 23 | tests:[
|
30 |
| -"path/to/test.js" |
| 24 | +'path/to/test.js' |
31 | 25 | ],
|
32 | 26 | description:'Task One\n'
|
33 | 27 | });
|
34 | 28 | });
|
35 | 29 |
|
36 |
| -it('should take an array of test files',function(){ |
37 |
| -varlines=['+ Task One','',"@test(['path/to/test.js', 'path/to/test2.js'])"]; |
38 |
| -varnext=task(result(),lines,index()); |
39 |
| -varnextTask=next.chapters[0].pages[0].tasks[0]; |
| 30 | +it('should take an array of test files',()=>{ |
| 31 | +constlines=['+ Task One','',"@test(['path/to/test.js', 'path/to/test2.js'])"]; |
| 32 | +constnext=task({result:result(), lines,index:index()}); |
| 33 | +constnextTask=next.pages[0].tasks[0]; |
40 | 34 | expect(nextTask).to.deep.equal({
|
41 | 35 | tests:[
|
42 |
| -"path/to/test.js","path/to/test2.js" |
| 36 | +'path/to/test.js','path/to/test2.js' |
43 | 37 | ],
|
44 | 38 | description:'Task One\n'
|
45 | 39 | });
|
|