Fix various tests due to projects rework

This commit is contained in:
Nick O'Leary
2018-01-16 16:18:18 +00:00
parent 1f3f32d377
commit 52475df783
7 changed files with 77 additions and 44 deletions

View File

@@ -136,7 +136,7 @@ describe("red/nodes/index", function() {
var userDir = path.join(__dirname,".testUserHome");
before(function(done) {
sinon.stub(log,"log");
sinon.stub(log,"log",function(){});
fs.remove(userDir,function(err) {
fs.mkdir(userDir,function() {
sinon.stub(index, 'load', function() {
@@ -159,7 +159,7 @@ describe("red/nodes/index", function() {
});
after(function(done) {
fs.remove(userDir,function() {;
fs.remove(userDir,function() {
runtime.stop().then(function() {
index.load.restore();
localfilesystem.getCredentials.restore();

View File

@@ -26,7 +26,9 @@ describe('storage/localfilesystem', function() {
var mockRuntime = {
log:{
_:function() { return "placeholder message"},
info: function() { }
info: function() { },
warn: function() { },
trace: function() {}
}
};
var userDir = path.join(__dirname,".testUserHome");
@@ -290,7 +292,7 @@ describe('storage/localfilesystem', function() {
it('should fsync the flows file',function(done) {
var flowFile = 'test.json';
var flowFilePath = path.join(userDir,flowFile);
localfilesystem.init({userDir:userDir, flowFile:flowFilePath}).then(function() {
localfilesystem.init({userDir:userDir, flowFile:flowFilePath}, mockRuntime).then(function() {
sinon.spy(fs,"fsync");
localfilesystem.saveFlows(testFlow).then(function() {
fs.fsync.callCount.should.eql(1);
@@ -307,7 +309,7 @@ describe('storage/localfilesystem', function() {
it('should log fsync errors and continue',function(done) {
var flowFile = 'test.json';
var flowFilePath = path.join(userDir,flowFile);
localfilesystem.init({userDir:userDir, flowFile:flowFilePath}).then(function() {
localfilesystem.init({userDir:userDir, flowFile:flowFilePath}, mockRuntime).then(function() {
sinon.stub(fs,"fsync", function(fd, cb) {
cb(new Error());
});