Skip to content

Commit a98e63f

Browse files
Dzianis KhviadzinichDzianis Khviadzinich
Dzianis Khviadzinich
authored and
Dzianis Khviadzinich
committed
Migrate to ES6
1 parent 276e3f3 commit a98e63f

File tree

3 files changed

+29
-35
lines changed

3 files changed

+29
-35
lines changed

extensions/it-optional.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
'use strict';
2-
3-
exports = module.exports = testOptional;
4-
5-
function testOptional(title, fn) {
6-
7-
it(title, function() {
8-
try {
9-
fn.call(this);
10-
} catch (err) {
11-
if (err.message=="Not implemented") {
12-
this.test.skip();
13-
} else {
14-
throw err;
15-
}
16-
}
17-
});
18-
19-
}
1+
module.exports = function testOptional(title, fn) {
2+
it(title, function () {
3+
try {
4+
fn.call(this);
5+
} catch (err) {
6+
if (err.message === 'Not implemented') {
7+
this.test.skip();
8+
} else {
9+
throw err;
10+
}
11+
}
12+
});
13+
};

task/01-first-tasks.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
function concatenateStrings(value1, value2) {
2-
return value1 + value2
2+
return value1 + value2;
33
}
44

5-
function testingPassFunction(value1, value2) {
6-
throw new Error('Not implemented');
5+
function testingPassFunction() {
6+
throw new Error('Not implemented');
77
}
88

99
module.exports = {
10-
concatenateStrings: concatenateStrings,
11-
testingPassFunction: testingPassFunction,
12-
}
10+
concatenateStrings,
11+
testingPassFunction,
12+
};

test/01-first-tests.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
var assert = require('assert');
2-
var tasks = require('../task/01-first-tasks');
1+
const assert = require('assert');
2+
const tasks = require('../task/01-first-tasks');
33
it.optional = require('../extensions/it-optional');
44

5-
describe('01-first-tests', function() {
6-
it('concatenateStrings should return concatenation of two strings', function() {
7-
assert.equal(tasks.concatenateStrings('a', 'b'), 'ab');
8-
});
9-
it.optional('testingPassFunction should ignore a test', function() {
10-
assert.equal(tasks.testingPassFunction(), 'ab');
11-
});
12-
});
5+
describe('01-first-tests', () => {
6+
it('concatenateStrings should return concatenation of two strings', () => {
7+
assert.equal(tasks.concatenateStrings('a', 'b'), 'ab');
8+
});
9+
it.optional('testingPassFunction should ignore a test', () => {
10+
assert.equal(tasks.testingPassFunction(), 'test');
11+
});
12+
});

0 commit comments

Comments
 (0)