Skip to content

Commit b7da9d1

Browse files
committed
Add hpw package and auto checks
1 parent 8274035 commit b7da9d1

File tree

6 files changed

+90
-0
lines changed

6 files changed

+90
-0
lines changed

Exercises/21-inc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
const inc = undefined;
4+
5+
module.exports = { inc };

Exercises/21-inc.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
({
2+
name: 'inc',
3+
length: [30, 70],
4+
tests: [
5+
[0, 1],
6+
[1, 2],
7+
[-1, 0],
8+
[10000, 10001],
9+
],
10+
test: inc => {
11+
const a = 5;
12+
const b = inc(a);
13+
if (a === b) throw new Error('Result should not be equal to argument');
14+
if (typeof b !== 'number') throw new Error('Result should be Number');
15+
}
16+
})

Exercises/22-inc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
const inc = undefined;
4+
5+
module.exports = { inc };

Exercises/22-inc.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
({
2+
name: 'inc',
3+
length: [30, 70],
4+
tests: [
5+
[{ n: 0 }, { n: 1 }],
6+
[{ n: 1 }, { n: 2 }],
7+
[{ n: -1 }, { n: 0 }],
8+
[{ n: 10000 }, { n: 10001 }],
9+
],
10+
test: inc => {
11+
const a = { n: 5 };
12+
const b = inc(a);
13+
if (a !== b) throw new Error('Result and argument should be equal');
14+
if (typeof b !== 'object') throw new Error('Result should be Object');
15+
}
16+
})

package-lock.json

Lines changed: 35 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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "example",
3+
"private": true,
4+
"version": "1.0.0",
5+
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",
6+
"license": "MIT",
7+
"scripts": {
8+
"test": "eslint ./Exercises && hpw"
9+
},
10+
"dependencies": {
11+
"hpw": "^0.1.2"
12+
}
13+
}

0 commit comments

Comments
 (0)