|
1 |
| -var expect = require('chai').expect; |
2 |
| -var task = require('../lib/build/parser/task').task; |
3 |
| -var trim = require('../lib/build/parser/actions').trimCommandValue; |
| 1 | +const { expect } = require('chai'); |
| 2 | +const { task } = require('../lib/build/parser/task'); |
| 3 | +const trim = require('../lib/build/parser/actions').trimCommandValue; |
4 | 4 |
|
5 |
| -var result = function() { |
6 |
| - return { |
7 |
| - chapters: [{ |
8 |
| - pages: [{ |
9 |
| - tasks: [] |
10 |
| - }] |
11 |
| - }] |
12 |
| - }; |
13 |
| -}; |
14 |
| -var index = function() { |
15 |
| - return { |
16 |
| - chapter: 0, |
17 |
| - page: 0, |
18 |
| - task: -1 |
19 |
| - }; |
20 |
| -}; |
| 5 | +const result = () => ({ |
| 6 | + pages: [{ |
| 7 | + tasks: [] |
| 8 | + }] |
| 9 | +}); |
21 | 10 |
|
22 |
| -describe('@test', function() { |
| 11 | +const index = () => ({ |
| 12 | + page: 0, |
| 13 | + task: -1 |
| 14 | +}); |
23 | 15 |
|
24 |
| - it('should take a single test file', function() { |
25 |
| - var lines = ['+ Task One', '', "@test('path/to/test.js')"]; |
26 |
| - var next = task(result(), lines, index()); |
27 |
| - var nextTask = next.chapters[0].pages[0].tasks[0]; |
| 16 | +describe('@test', () => { |
| 17 | + |
| 18 | + it('should take a single test file', () => { |
| 19 | + const lines = ['+ Task One', '', "@test('path/to/test.js')"]; |
| 20 | + const next = task({ result: result(), lines, index: index() }); |
| 21 | + const nextTask = 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 |
| - var lines = ['+ Task One', '', "@test(['path/to/test.js', 'path/to/test2.js'])"]; |
38 |
| - var next = task(result(), lines, index()); |
39 |
| - var nextTask = next.chapters[0].pages[0].tasks[0]; |
| 30 | + it('should take an array of test files', () => { |
| 31 | + const lines = ['+ Task One', '', "@test(['path/to/test.js', 'path/to/test2.js'])"]; |
| 32 | + const next = task({ result: result(), lines, index: index() }); |
| 33 | + const nextTask = 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 | });
|
|
0 commit comments