mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Change default data dir
Changes the default location for user data to $HOME/.node-red.
This commit is contained in:
@@ -17,6 +17,7 @@ var should = require("should");
|
||||
var when = require("when");
|
||||
var sinon = require("sinon");
|
||||
var child_process = require('child_process');
|
||||
var fs = require("fs");
|
||||
|
||||
var comms = require("../../red/comms");
|
||||
var redNodes = require("../../red/nodes");
|
||||
@@ -133,7 +134,7 @@ describe("red/server", function() {
|
||||
});
|
||||
|
||||
it("rejects when npm returns a 404", function(done) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,cb) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,opt,cb) {
|
||||
cb(new Error(),""," 404 this_wont_exist");
|
||||
});
|
||||
|
||||
@@ -145,14 +146,13 @@ describe("red/server", function() {
|
||||
});
|
||||
});
|
||||
it("rejects with generic error", function(done) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,cb) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,opt,cb) {
|
||||
cb(new Error("test_error"),"","");
|
||||
});
|
||||
|
||||
server.installModule("this_wont_exist").then(function() {
|
||||
done(new Error("Unexpected success"));
|
||||
}).otherwise(function(err) {
|
||||
err.message.should.be.eql("Install failed");
|
||||
done();
|
||||
}).finally(function() {
|
||||
exec.restore();
|
||||
@@ -160,7 +160,7 @@ describe("red/server", function() {
|
||||
});
|
||||
it("succeeds when module is found", function(done) {
|
||||
var nodeInfo = {module:"foo",types:["a"]};
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,cb) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,opt,cb) {
|
||||
cb(null,"","");
|
||||
});
|
||||
var addModule = sinon.stub(redNodes,"addModule",function(md) {
|
||||
@@ -198,14 +198,13 @@ describe("red/server", function() {
|
||||
var removeModule = sinon.stub(redNodes,"removeModule",function(md) {
|
||||
return when.resolve(nodeInfo);
|
||||
});
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,cb) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,opt,cb) {
|
||||
cb(new Error("test_error"),"","");
|
||||
});
|
||||
|
||||
server.uninstallModule("this_wont_exist").then(function() {
|
||||
done(new Error("Unexpected success"));
|
||||
}).otherwise(function(err) {
|
||||
err.message.should.be.eql("Removal failed");
|
||||
done();
|
||||
}).finally(function() {
|
||||
exec.restore();
|
||||
@@ -217,9 +216,10 @@ describe("red/server", function() {
|
||||
var removeModule = sinon.stub(redNodes,"removeModule",function(md) {
|
||||
return nodeInfo;
|
||||
});
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,cb) {
|
||||
var exec = sinon.stub(child_process,"exec",function(cmd,opt,cb) {
|
||||
cb(null,"","");
|
||||
});
|
||||
var exists = sinon.stub(fs,"existsSync", function(fn) { return true; });
|
||||
|
||||
server.uninstallModule("this_wont_exist").then(function(info) {
|
||||
info.should.eql(nodeInfo);
|
||||
@@ -232,6 +232,7 @@ describe("red/server", function() {
|
||||
}).finally(function() {
|
||||
exec.restore();
|
||||
removeModule.restore();
|
||||
exists.restore();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user