Skip to content

Commit cb854a7

Browse files
Dzianis KhviadzinichDzianis Khviadzinich
Dzianis Khviadzinich
authored and
Dzianis Khviadzinich
committed
environments setup
1 parent e6d32f6 commit cb854a7

File tree

5 files changed

+259
-0
lines changed

5 files changed

+259
-0
lines changed

extensions/it-optional.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

package-lock.json

Lines changed: 195 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "nodejs-assessment",
3+
"version": "1.0.0",
4+
"description": "NodeJS training tasks",
5+
"scripts": {
6+
"test": "mocha"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/it-shark-pro/nodejs-assessment.git"
11+
},
12+
"author": "",
13+
"license": "MIT",
14+
"bugs": {
15+
"url": "https://github.com/it-shark-pro/nodejs-assessment/issues"
16+
},
17+
"homepage": "https://github.com/it-shark-pro/nodejs-assessment#readme",
18+
"devDependencies": {
19+
"mocha": "^5.0.0"
20+
}
21+
}

task/01-first-tasks.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function concatenateStrings(value1, value2) {
2+
return value1 + value2
3+
}
4+
5+
function testingPassFunction(value1, value2) {
6+
throw new Error('Not implemented');
7+
}
8+
9+
module.exports = {
10+
concatenateStrings: concatenateStrings,
11+
testingPassFunction: testingPassFunction,
12+
}

test/01-first-tests.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var assert = require('assert');
2+
var tasks = require('../task/01-first-tasks');
3+
it.optional = require('../extensions/it-optional');
4+
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+
});

0 commit comments

Comments
 (0)