add proper mocha tests and update deps

This commit is contained in:
2016-02-03 12:52:09 +01:00
parent 9edab1b3ec
commit 32465d2556
16 changed files with 121 additions and 2156 deletions

View File

@ -1 +1 @@
This is some test text stored in ./test/mytest.txt -> If this is displayed when running "npm test", then the test has succeeded.
Some TestString &&%$

30
test/test.js Normal file
View File

@ -0,0 +1,30 @@
/// <reference path="typings/main.d.ts" />
var smartfile = require("../index.js");
var beautylog = require("beautylog");
var should = require("should");
var vinyl = require("vinyl");
describe("smartfile", function () {
describe(".readFileToString".yellow, function () {
it("should read a file to a string", function () {
should.equal(smartfile.readFileToString("./test/mytest.txt"), "Some TestString &&%$");
});
});
describe(".readFileToObject".yellow, function () {
it("should read an " + ".yaml".blue + " file to an object", function () {
var testData = smartfile.readFileToObject("./test/mytest.yaml");
testData.should.have.property("key1", "this works");
testData.should.have.property("key2", "this works too");
});
it("should read an " + ".json".blue + " file to an object", function () {
var testData = smartfile.readFileToObject("./test/mytest.json");
testData.should.have.property("key1", "this works");
testData.should.have.property("key2", "this works too");
});
});
describe(".readFileToVinyl".yellow, function () {
it("should read an " + ".json OR .yaml".blue + " file to an " + "vinyl file object".cyan, function () {
var testData = smartfile.readFileToVinyl("./test/mytest.json");
(vinyl.isVinyl(testData)).should.be.true();
});
});
});