Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit a44dca5

Browse files
use jest to test
1 parent 37d566e commit a44dca5

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

__tests__/index-spec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const fs = require("fs");
22

3-
const checkFile = file => {
4-
if (fs.existsSync(file)) {
5-
console.log(`Success! \n${file} exists!\n`);
6-
} else {
7-
console.log(`Failure! \n${file} does not exist!\n`);
8-
}
9-
};
10-
11-
checkFile("snow-leopard");
12-
checkFile("snow-leopard/pages/index.js");
13-
checkFile("snow-leopard/components/code-area.js");
3+
describe("it checks that the project was create successfully", () => {
4+
it("checks that the project was initiated", () => {
5+
expect(fs.existsSync("snow-leopard/package.json")).toBe(true);
6+
});
7+
it("checks that the project template was created", () => {
8+
expect(fs.existsSync("snow-leopard/components/")).toBe(true);
9+
});
10+
it("checks that the project template was created", () => {
11+
expect(fs.existsSync("snow-leopard/pages/index.js")).toBe(true);
12+
});
13+
});

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/alexandercbooth/create-nteract-app.git"
88
},
99
"scripts": {
10-
"test": "node __tests__/index-spec.js"
10+
"test": "jest"
1111
},
1212
"author": "Alexander C. Booth <[email protected]>",
1313
"license": "MIT",
@@ -34,6 +34,7 @@
3434
},
3535
"devDependencies": {
3636
"husky": "^1.0.0-rc.13",
37+
"jest": "^23.5.0",
3738
"lint-staged": "^7.2.0",
3839
"prettier": "1.14.2"
3940
}

0 commit comments

Comments
 (0)