Added basic testing of the preprocessor. Setup Mocha.

This commit is contained in:
Ryan Leonard 2017-03-13 08:16:52 -07:00
parent 1315823043
commit 20fce13763
2 changed files with 40 additions and 1 deletions

View File

@ -8,7 +8,7 @@
},
"scripts": {
"build": "spectacle -l test/fixtures/cheese.png test/fixtures/cheese.json",
"test": "node bin/spectacle -l test/fixtures/cheese.png test/fixtures/cheese.json",
"test": "mocha && node bin/spectacle -l test/fixtures/cheese.png test/fixtures/cheese.json",
"develop": "spectacle -d",
"start": "spectacle -s"
},
@ -54,5 +54,9 @@
"marked": "^0.3.5",
"tmp": "0.0.31",
"trace": "^1.1.0"
},
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.2.0"
}
}

35
test/test-preprocessor.js Normal file
View File

@ -0,0 +1,35 @@
var chai = require("chai");
var should = chai.should();
var preprocessor = require("../app/lib/preprocessor");
var minimal = require("./minimal");
describe("preprocessor", function() {
var spec = null;
var processed = null;
beforeEach(function() {
spec = Object.assign({}, minimal);
processed = preprocessor({}, spec);
});
describe("with minimal spec", function() {
it("should retain initial values", function() {
Object.assign({}, processed, minimal).should.deep.equal(processed);
});
it("should add 'tags'", function() {
processed.should.have.property("tags");
processed.tags.should.deep.equal([]);
});
it("should add 'showTagSummary'", function() {
processed.should.have.property("showTagSummary", false);
});
});
});