Pārlūkot izejas kodu

Added mocha, chai, and sinon for unit testing. Created a test-setup.spec file.

master
Bryan Miller pirms 5 gadiem
vecāks
revīzija
2644d60d8c
2 mainītis faili ar 19 papildinājumiem un 1 dzēšanām
  1. +6
    -1
      package.json
  2. +13
    -0
      test/test-setup.spec.js

+ 6
- 1
package.json Parādīt failu

@@ -4,7 +4,7 @@
"description": "A Fo-terminal-like website hosting system.",
"main": "wwwterm.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha"
},
"author": "Bryan Miller",
"license": "ISC",
@@ -15,5 +15,10 @@
"ejs": "2.6.2",
"express": "4.17.1",
"sass": "1.22.7"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.0",
"sinon": "^7.3.2"
}
}

+ 13
- 0
test/test-setup.spec.js Parādīt failu

@@ -0,0 +1,13 @@

// NOTE: Idea for this file comes from https://blog.risingstack.com/node-hero-node-js-unit-testing-tutorial/
const sinon = require('sinon');
const chai = require('chai');

beforeEach(function(){
this.sandbox = sinon.sandbox.create();
})

afterEach(function(){
this.sandbox.restore();
});


Notiek ielāde…
Atcelt
Saglabāt