kopia lustrzana https://github.com/c9/core
add unit tests
rodzic
cfa07f4449
commit
e8dcd182f8
|
@ -49,7 +49,7 @@ describe('vfs-local', function () {
|
||||||
});
|
});
|
||||||
it('should reject paths that resolve outside the root', function (done) {
|
it('should reject paths that resolve outside the root', function (done) {
|
||||||
vfs.resolve("/../test-local.js", {}, function (err, meta) {
|
vfs.resolve("/../test-local.js", {}, function (err, meta) {
|
||||||
expect(err).property("code").equals("EACCESS");
|
expect(err).property("code").equals("EACCES");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -893,6 +893,12 @@ describe('vfs-local', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("should error with EACCES if the same extension name is empty", function (done) {
|
||||||
|
vfs.extend("", {file: __dirname + "/math.js"}, function (err, meta) {
|
||||||
|
expect(err).property("code").equal("EACCES");
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
it("should allow a redefine if options.redefine is set", function (done) {
|
it("should allow a redefine if options.redefine is set", function (done) {
|
||||||
vfs.extend("test", {file: __dirname + "/math.js"}, function (err, meta) {
|
vfs.extend("test", {file: __dirname + "/math.js"}, function (err, meta) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
|
@ -34,7 +34,7 @@ module.exports = function(methods, vfsHome, vfsWorkspace) {
|
||||||
|
|
||||||
function wrap(name, excluded) {
|
function wrap(name, excluded) {
|
||||||
if (excluded) {
|
if (excluded) {
|
||||||
return function(){
|
return function() {
|
||||||
vfsWorkspace[name].apply(vfsWorkspace, arguments);
|
vfsWorkspace[name].apply(vfsWorkspace, arguments);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,8 @@ module.exports = function(methods, vfsHome, vfsWorkspace) {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
|
||||||
PATH_OPTIONS.forEach(function(o) {
|
PATH_OPTIONS.forEach(function(o) {
|
||||||
options[o] = options[o] && substituteTilde(options[o]);
|
if (options[o] && typeof options[o] == "string")
|
||||||
|
options[o] = substituteTilde(options[o]);
|
||||||
});
|
});
|
||||||
args[1] = options;
|
args[1] = options;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue