smartfile/test/test.js

182 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 path = require("path");
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, path.join(process.cwd(), "./test/temp/testMemToFs.txt")).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, path.join(process.cwd(), "./test/temp/testMemToFsSync.txt"));
});
});
});
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsSUFBWSxTQUFTLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFDM0MsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ3JDLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUMzQixJQUFJLFNBQVMsR0FBRyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUM7QUFDekMsSUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsSUFBTyxNQUFN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cbiAgICAgICAgICAgICAgICAgICAgICAgIGZvbGRlckFycmF5QXJnLnNob3VsZC5jb250YWluRGVlcChbIFwidGVzdGZvbGRlclwiXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXJBcnJheUFyZy5zaG91bGQubm90LmNvbnRhaW5EZWVwKFsgXCJub3RFeGlzdGVudEZvbGRlclwiXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi5jb3B5KClcIi55ZWxsb3csZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGNvcHkgYSBkaXJlY3RvcnlcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIHNtYXJ0ZmlsZS5mcy5jb3B5KFwiLi90ZXN0L3Rlc3Rmb2xkZXIvXCIsXCIuL3Rlc3QvdGVtcC9cIilcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgY29weSBhIGZpbGVcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIHNtYXJ0ZmlsZS5mcy5jb3B5KFwiLi90ZXN0L215dGVzdC55YW1sXCIsXCIuL3Rlc3QvdGVtcC9cIilcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgY29weSBhIGZpbGUgYW5kIHJlbmFtZSBpdFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgc21hcnRmaWxlLmZzLmNvcHkoXCIuL3Rlc3QvbXl0ZXN0LnlhbWxcIixcIi4vdGVzdC90ZW1wL215dGVzdFJlbmFtZWQueWFtbFwiKVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi5yZW1vdmUoKVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBpdChcInNob3VsZ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XCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICBsZXQgbG9jYWxTdHJpbmdBcnJheSA9IFtcInN0cmluZzFcIixcInN0cmluZzJcIixcInN0cmluZzNcIl07XG4gICAgICAgICAgICAgICAgbGV0IGxvY2FsT3B0aW9ucyA9IHtmaWxlbmFtZTpcInZpbnlsZmlsZTJcIixiYXNlOlwiL3NvbWVEaXJcIn07XG4gICAgICAgICAgICAgICAgbGV0IHRlc3RSZXN1bHQgPSBzbWFydGZpbGUubWVtb3J5LnRvVmlueWxBcnJheVN5bmMobG9jYWxTdHJpbmdBcnJheSxsb2NhbE9wdGlvbnMpO1xuICAgICAgICAgICAgICAgIHRlc3RSZXN1bHQuc2hvdWxkLmJlLkFycmF5KCk7XG4gICAgICAgICAgICAgICAgKHRlc3RSZXN1bHQubGVuZ3RoID09PSAzKS5zaG91bGQuYmUudHJ1ZSgpO1xuICAgICAgICAgICAgICAgIGZvciAobGV0IG15S2V5IGluIHRlc3RSZXN1bHQpe1xuICAgICAgICAgICAgICAgICAgICAodGVzdFJlc3VsdFtteUtleV0gaW5zdGFuY2VvZiB2aW55bCkuc2hvdWxkLmJlLnRydWUoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGRlc2NyaWJlKFwidG9TdHJpbmdTeW5jKClcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcHJvZHVjZSBhIFN0cmluZyBmcm9tIHZpbnlsIGZpbGVcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGxldCBsb2NhbFN0cmluZyA9IHNtYXJ0ZmlsZS5tZW1vcnkudG9TdHJpbmdTeW5jKG5ldyB2aW55bCh7XG4gICAgICAgICAgICAgICAgICAgIGJhc2U6XCIvXCIsXG4gICAgICAgICAgICAgICAgICAgIHBhdGg6XCIvdGVzdC50eHRcIixcbiAgICAgICAgICAgICAgICAgICAgY29udGVudHM6IG5ldyBCdWZmZXIoXCJteVN0cmluZ1wiKVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICBsb2NhbFN0cmluZy5zaG91bGQuZXF1YWwoXCJteVN0cmluZ1wiKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgZGVzY3JpYmUoXCJ0b0ZzKClcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgd3JpdGUgYSBmaWxlIHRvIGRpc2sgYW5kIHJldHVybiBhIHByb21pc2VcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICBsZXQgbG9jYWxTdHJpbmcgPSBcIm15U3RyaW5nXCI7XG4gICAgICAgICAgICAgICAgc21hcnRmaWxlLm1lbW9yeS50b0ZzKFxuICAgICAgICAgICAgICAgICAgICBsb2NhbFN0cmluZyxcbiAgICAgICAgICAgICAgICAgICAgcGF0aC5qb2luKHByb2Nlc3MuY3dkKCksXCIuL3Rlc3QvdGVtcC90ZXN0TWVtVG9Gcy50eHRcIilcbiAgICAgICAgICAgICAgICApLnRoZW4oZG9uZSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGRlc2NyaWJlKFwidG9Gc1N5bmMoKVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBpdChcInNob3VsZCB3cml0ZSBhIGZpbGUgdG8gZGlzayBhbmQgcmV0dXJuIHRydWUgaWYgc3VjY2Vzc2Z1bGxcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGxldCBsb2NhbFN0cmluZyA9IFwibXlTdHJpbmdcIjtcbiAgICAgICAgICAgICAgICBzbWFydGZpbGUubWVtb3J5LnRvRnNTeW5jKFxuICAgICAgICAgICAgICAgICAgICBsb2NhbFN0cmluZyxcbiAgICAgICAgICAgICAgICAgICAgcGF0aC5qb2luKHByb2Nlc3MuY3dkKCksXCIuL3Rlc3QvdGVtcC90ZXN0TWVtVG9Gc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W9uKHJlc3BvbnNlU3RyaW5nKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3VsZC5lcXVhbChyZXNwb25zZVN0cmluZyxcIlNvbWUgVGVzdFN0cmluZyAmJiUkXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcmVqZWN0IGEgUHJvbWlzZSB3aGVuIHRoZSBsaW5rIGlzIGZhbHNlXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcbiAgICAgICAgICAgICAgICBzbWFydGZpbGUucmVtb3RlLnRvU3RyaW5nKFwiaHR0cHM6Ly9wdXNoLnJvY2tzL2RvZXNub3RleGlzdC50eHRcIilcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInRoaXMgdGVzdCBzaG91bGQgbm90IGJlIHJlc29sdmVkXCIpO1xuICAgICAgICAgICAgICAgICAgICB9LGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgfSlcbn0pO1xuIl19