smartfile/test/test.js
2016-06-23 18:39:02 +02:00

187 lines
30 KiB
JavaScript

"use strict";
require("typings-test");
var smartfile = require("../dist/index");
var beautylog = require("beautylog");
var gulp = require("gulp");
var gFunction = require("gulp-function");
var should = require("should");
var vinyl = require("vinyl");
describe("smartfile".yellow, function () {
describe(".fs".yellow, function () {
describe(".fileExistsSync".yellow, function () {
it("should return an accurate boolean", function () {
(smartfile.fs.fileExistsSync("./test/mytest.json")).should.be.true();
(smartfile.fs.fileExistsSync("./test/notthere.json")).should.be.false();
});
});
describe(".fileExists".yellow, function () {
it("should return a working promise", function () {
(smartfile.fs.fileExists("./test/mytest.json")).should.be.Promise();
(smartfile.fs.fileExists("./test/mytest.json")).should.be.fulfilled();
(smartfile.fs.fileExists("./test/notthere.json")).should.not.be.fulfilled();
});
});
describe(".listFoldersSync()", function () {
it("should get the file type from a string", function () {
smartfile.fs.listFoldersSync("./test/").should.containDeep(["testfolder"]);
smartfile.fs.listFoldersSync("./test/").should.not.containDeep(["notExistentFolder"]);
});
});
describe(".listFolders()", function () {
it("should get the file type from a string", function (done) {
smartfile.fs.listFolders("./test/")
.then(function (folderArrayArg) {
folderArrayArg.should.containDeep(["testfolder"]);
folderArrayArg.should.not.containDeep(["notExistentFolder"]);
done();
});
});
});
describe(".copy()".yellow, function () {
it("should copy a directory", function () {
smartfile.fs.copy("./test/testfolder/", "./test/temp/");
});
it("should copy a file", function () {
smartfile.fs.copy("./test/mytest.yaml", "./test/temp/");
});
it("should copy a file and rename it", function () {
smartfile.fs.copy("./test/mytest.yaml", "./test/temp/mytestRenamed.yaml");
});
});
describe(".remove()", function () {
it("should remove an entire directory", function () {
});
it("should remove single files", function () {
});
});
});
describe(".interpreter", function () {
describe(".filetype()", function () {
it("should get the file type from a string", function () {
smartfile.interpreter.filetype("./somefolder/data.json").should.equal("json");
});
});
});
describe(".fs".yellow, function () {
describe("toGulpStreamSync() and toGulpDestSync", function () {
it("should produce a gulp stream", function (done) {
smartfile.fs.toGulpStreamSync("./test/my*")
.pipe(smartfile.fs.toGulpDestSync("./test/temp/"))
.pipe(gFunction(done, "atEnd"));
});
});
describe(".toObjectSync()".yellow, function () {
it("should read an " + ".yaml".blue + " file to an object", function () {
var testData = smartfile.fs.toObjectSync("./test/mytest.yaml");
testData.should.have.property("key1", "this works");
testData.should.have.property("key2", "this works too");
});
it("should state unknown file type for unknown file types", function () {
var testData = smartfile.fs.toObjectSync("./test/mytest.txt");
});
it("should read an " + ".json".blue + " file to an object", function () {
var testData = smartfile.fs.toObjectSync("./test/mytest.json");
testData.should.have.property("key1", "this works");
testData.should.have.property("key2", "this works too");
});
});
describe(".toStringSync()".yellow, function () {
it("should read a file to a string", function () {
should.equal(smartfile.fs.toStringSync("./test/mytest.txt"), "Some TestString &&%$");
});
});
describe(".toVinylSync".yellow, function () {
it("should read an " + ".json OR .yaml".blue + " file to an " + "vinyl file object".cyan, function () {
var testData = smartfile.fs.toVinylSync("./test/mytest.json");
(vinyl.isVinyl(testData)).should.be.true();
});
});
});
describe(".memory", function () {
describe(".toGulpStream()", function () {
it("should produce a valid gulp stream", function () {
var localArray = ["test1", "test2", "test3"];
smartfile.memory.toGulpStream(localArray)
.pipe(gulp.dest("./test/temp/"));
});
});
describe("toVinylFileSync()", function () {
it("should produce a vinylFile", function () {
var localString = "myString";
var localOptions = { filename: "vinylfile2", base: "/someDir" };
(smartfile.memory.toVinylFileSync(localString, localOptions) instanceof vinyl).should.be.true();
});
});
describe("toVinylArraySync()", function () {
it("should produce a an array of vinylfiles", function () {
var localStringArray = ["string1", "string2", "string3"];
var localOptions = { filename: "vinylfile2", base: "/someDir" };
var testResult = smartfile.memory.toVinylArraySync(localStringArray, localOptions);
testResult.should.be.Array();
(testResult.length === 3).should.be.true();
for (var myKey in testResult) {
(testResult[myKey] instanceof vinyl).should.be.true();
}
});
});
describe("toStringSync()", function () {
it("should produce a String from vinyl file", function () {
var localString = smartfile.memory.toStringSync(new vinyl({
base: "/",
path: "/test.txt",
contents: new Buffer("myString")
}));
localString.should.equal("myString");
});
});
describe("toFs()", function () {
it("should write a file to disk and return a promise", function (done) {
var localString = "myString";
smartfile.memory.toFs(localString, {
fileName: "./test/temp/testMemToFs.txt",
filePath: process.cwd()
}).then(done);
});
});
describe("toFsSync()", function () {
it("should write a file to disk and return true if successfull", function () {
var localString = "myString";
smartfile.memory.toFsSync(localString, {
fileName: "./test/temp/testMemToFsSync.txt",
filePath: process.cwd()
});
});
});
});
describe(".remote", function () {
describe("toGulpStreamSync()", function () {
it("should produce a gulp stream", function (done) {
smartfile.remote.toGulpStreamSync("mytest.txt", "https://raw.githubusercontent.com/pushrocks/smartfile/master/test/")
.pipe(smartfile.fs.toGulpDestSync("./test/temp/"))
.pipe(gFunction(done, "atEnd"));
});
});
describe(".toString()", function () {
it("should load a remote file to a variable", function (done) {
this.timeout(5000);
smartfile.remote.toString("https://raw.githubusercontent.com/pushrocks/smartfile/master/test/mytest.txt")
.then(function (responseString) {
should.equal(responseString, "Some TestString &&%$");
done();
});
});
it("should reject a Promise when the link is false", function (done) {
this.timeout(10000);
smartfile.remote.toString("https://push.rocks/doesnotexist.txt")
.then(function () {
throw new Error("this test should not be resolved");
}, function () {
done();
});
});
});
});
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsSUFBWSxTQUFTLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFDM0MsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ3JDLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUMzQixJQUFJLFNBQVMsR0FBRyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUM7QUFDekMsSUFBTyxNQUFNLFdBQVcsUUFBUSxDQUFDLEN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mUgZGlyZWN0b3J5XCIsZnVuY3Rpb24oKXtcblxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpdChcInNob3VsZCByZW1vdmUgc2luZ2xlIGZpbGVzXCIsZnVuY3Rpb24oKXtcblxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH0pO1xuXG4gICAgZGVzY3JpYmUoXCIuaW50ZXJwcmV0ZXJcIixmdW5jdGlvbigpe1xuICAgICAgICBkZXNjcmliZShcIi5maWxldHlwZSgpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGdldCB0aGUgZmlsZSB0eXBlIGZyb20gYSBzdHJpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIHNtYXJ0ZmlsZS5pbnRlcnByZXRlci5maWxldHlwZShcIi4vc29tZWZvbGRlci9kYXRhLmpzb25cIikuc2hvdWxkLmVxdWFsKFwianNvblwiKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9KTtcblxuXG4gICAgZGVzY3JpYmUoXCIuZnNcIi55ZWxsb3csZnVuY3Rpb24oKXtcbiAgICAgICAgZGVzY3JpYmUoXCJ0b0d1bHBTdHJlYW1TeW5jKCkgYW5kIHRvR3VscERlc3RTeW5jXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIHByb2R1Y2UgYSBndWxwIHN0cmVhbVwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIHNtYXJ0ZmlsZS5mcy50b0d1bHBTdHJlYW1TeW5jKFwiLi90ZXN0L215KlwiKVxuICAgICAgICAgICAgICAgICAgICAucGlwZShzbWFydGZpbGUuZnMudG9HdWxwRGVzdFN5bmMoXCIuL3Rlc3QvdGVtcC9cIikpXG4gICAgICAgICAgICAgICAgICAgIC5waXBlKGdGdW5jdGlvbihkb25lLFwiYXRFbmRcIikpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi50b09iamVjdFN5bmMoKVwiLnllbGxvdyxmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcmVhZCBhbiBcIiArIFwiLnlhbWxcIi5ibHVlICsgXCIgZmlsZSB0byBhbiBvYmplY3RcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGxldCB0ZXN0RGF0YSA9IHNtYXJ0ZmlsZS5mcy50b09iamVjdFN5bmMoXCIuL3Rlc3QvbXl0ZXN0LnlhbWxcIik7XG4gICAgICAgICAgICAgICAgdGVzdERhdGEuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJrZXkxXCIsXCJ0aGlzIHdvcmtzXCIpO1xuICAgICAgICAgICAgICAgIHRlc3REYXRhLnNob3VsZC5oYXZlLnByb3BlcnR5KFwia2V5MlwiLFwidGhpcyB3b3JrcyB0b29cIik7XG5cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgc3RhdGUgdW5rbm93biBmaWxlIHR5cGUgZm9yIHVua25vd24gZmlsZSB0eXBlc1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgbGV0IHRlc3REYXRhID0gc21hcnRmaWxlLmZzLnRvT2JqZWN0U3luYyhcIi4vdGVzdC9teXRlc3QudHh0XCIpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpdChcInNob3VsZCByZWFkIGFuIFwiICsgXCIuanNvblwiLmJsdWUgKyBcIiBmaWxlIHRvIGFuIG9iamVjdFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgbGV0IHRlc3REYXRhID0gc21hcnRmaWxlLmZzLnRvT2JqZWN0U3luYyhcIi4vdGVzdC9teXRlc3QuanNvblwiKTtcbiAgICAgICAgICAgICAgICB0ZXN0RGF0YS5zaG91bGQuaGF2ZS5wcm9wZXJ0eShcImtleTFcIixcInRoaXMgd29ya3NcIik7XG4gICAgICAgICAgICAgICAgdGVzdERhdGEuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJrZXkyXCIsXCJ0aGlzIHdvcmtzIHRvb1wiKTtcblxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi50b1N0cmluZ1N5bmMoKVwiLnllbGxvdyxmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcmVhZCBhIGZpbGUgdG8gYSBzdHJpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIHNob3VsZC5lcXVhbChcbiAgICAgICAgICAgICAgICAgICAgc21hcnRmaWxlLmZzLnRvU3RyaW5nU3luYyhcIi4vdGVzdC9teXRlc3QudHh0XCIpLFxuICAgICAgICAgICAgICAgICAgICBcIlNvbWUgVGVzdFN0cmluZyAmJiUkXCJcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi50b1ZpbnlsU3luY1wiLnllbGxvdyxmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcmVhZCBhbiBcIiArIFwiLmpzb24gT1IgLnlhbWxcIi5ibHVlICsgXCIgZmlsZSB0byBhbiBcIiArIFwidmlueWwgZmlsZSBvYmplY3RcIi5jeWFuLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgbGV0IHRlc3REYXRhID0gc21hcnRmaWxlLmZzLnRvVmlueWxTeW5jKFwiLi90ZXN0L215dGVzdC5qc29uXCIpO1xuICAgICAgICAgICAgICAgICh2aW55bC5pc1ZpbnlsKHRlc3REYXRhKSkuc2hvdWxkLmJlLnRydWUoKTtcblxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH0pO1xuXG4gICAgZGVzY3JpYmUoXCIubWVtb3J5XCIsZnVuY3Rpb24oKXtcbiAgICAgICAgZGVzY3JpYmUoXCIudG9HdWxwU3RyZWFtKClcIixmdW5jdG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ID0gW1wic3RyaW5nMVwiLFwic3RyaW5nMlwiLFwic3RyaW5nM1wiXTtcbiAgICAgICAgICAgICAgICBsZXQgbG9jYWxPcHRpb25zID0ge2ZpbGVuYW1lOlwidmlueWxmaWxlMlwiLGJhc2U6XCIvc29tZURpclwifTtcbiAgICAgICAgICAgICAgICBsZXQgdGVzdFJlc3VsdCA9IHNtYXJ0ZmlsZS5tZW1vcnkudG9WaW55bEFycmF5U3luYyhsb2NhbFN0cmluZ0FycmF5LGxvY2FsT3B0aW9ucyk7XG4gICAgICAgICAgICAgICAgdGVzdFJlc3VsdC5zaG91bGQuYmUuQXJyYXkoKTtcbiAgICAgICAgICAgICAgICAodGVzdFJlc3VsdC5sZW5ndGggPT09IDMpLnNob3VsZC5iZS50cnVlKCk7XG4gICAgICAgICAgICAgICAgZm9yIChsZXQgbXlLZXkgaW4gdGVzdFJlc3VsdCl7XG4gICAgICAgICAgICAgICAgICAgICh0ZXN0UmVzdWx0W215S2V5XSBpbnN0YW5jZW9mIHZpbnlsKS5zaG91bGQuYmUudHJ1ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgZGVzY3JpYmUoXCJ0b1N0cmluZ1N5bmMoKVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBpdChcInNob3VsZCBwcm9kdWNlIGEgU3RyaW5nIGZyb20gdmlueWwgZmlsZVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgbGV0IGxvY2FsU3RyaW5nID0gc21hcnRmaWxlLm1lbW9yeS50b1N0cmluZ1N5bmMobmV3IHZpbnlsKHtcbiAgICAgICAgICAgICAgICAgICAgYmFzZTpcIi9cIixcbiAgICAgICAgICAgICAgICAgICAgcGF0aDpcIi90ZXN0LnR4dFwiLFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50czogbmV3IEJ1ZmZlcihcIm15U3RyaW5nXCIpXG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgIGxvY2FsU3RyaW5nLnNob3VsZC5lcXVhbChcIm15U3RyaW5nXCIpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcInRvRnMoKVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBpdChcInNob3VsZCB3cml0ZSBhIGZpbGUgdG8gZGlzayBhbmQgcmV0dXJuIGEgcHJvbWlzZVwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIGxldCBsb2NhbFN0cmluZyA9IFwibXlTdHJpbmdcIjtcbiAgICAgICAgICAgICAgICBzbWFydGZpbGUubWVtb3J5LnRvRnMoXG4gICAgICAgICAgICAgICAgICAgIGxvY2FsU3RyaW5nLFxuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTpcIi4vdGVzdC90ZW1wL3Rlc3RNZW1Ub0ZzLnR4dFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZVBhdGg6cHJvY2Vzcy5jd2QoKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKS50aGVuKGRvbmUpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcInRvRnNTeW5jKClcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgd3JpdGUgYSBmaWxlIHRvIGRpc2sgYW5kIHJldHVybiB0cnVlIGlmIHN1Y2Nlc3NmdWxsXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICBsZXQgbG9jYWxTdHJpbmcgPSBcIm15U3RyaW5nXCI7XG4gICAgICAgICAgICAgICAgc21hcnRmaWxlLm1lbW9yeS50b0ZzU3luYyhcbiAgICAgICAgICAgICAgICAgICAgbG9jYWxTdHJpbmcse1xuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZU5hbWU6XCIuL3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mdpdGh1YnVzZXJjb250ZW50LmNvbS9wdXNocm9ja3Mvc21hcnRmaWxlL21hc3Rlci90ZXN0L215dGVzdC50eHRcIilcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VTdHJpbmcpe1xuICAgICAgICAgICAgICAgICAgICAgICAgc2hvdWxkLmVxdWFsKHJlc3BvbnNlU3RyaW5nLFwiU29tZSBUZXN0U3RyaW5nICYmJSRcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpdChcInNob3VsZCByZWplY3QgYSBQcm9taXNlIHdoZW4gdGhlIGxpbmsgaXMgZmFsc2VcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgICAgIHNtYXJ0ZmlsZS5yZW1vdGUudG9TdHJpbmcoXCJodHRwczovL3B1c2gucm9ja3MvZG9lc25vdGV4aXN0LnR4dFwiKVxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidGhpcyB0ZXN0IHNob3VsZCBub3QgYmUgcmVzb2x2ZWRcIik7XG4gICAgICAgICAgICAgICAgICAgIH0sZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9KVxufSk7XG4iXX0=