Skip to content

Commit cad8699

Browse files
committed
update @test tests
1 parent b7cc085 commit cad8699

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

test/test.spec.js

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,39 @@
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;
44

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+
});
2110

22-
describe('@test', function() {
11+
const index = () => ({
12+
page: 0,
13+
task: -1
14+
});
2315

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];
2822
expect(nextTask).to.deep.equal({
2923
tests: [
30-
"path/to/test.js"
24+
'path/to/test.js'
3125
],
3226
description: 'Task One\n'
3327
});
3428
});
3529

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];
4034
expect(nextTask).to.deep.equal({
4135
tests: [
42-
"path/to/test.js", "path/to/test2.js"
36+
'path/to/test.js', 'path/to/test2.js'
4337
],
4438
description: 'Task One\n'
4539
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy