diff --git a/red/settings.js b/red/settings.js index ee4bbe19c..1c7062e4e 100644 --- a/red/settings.js +++ b/red/settings.js @@ -26,6 +26,7 @@ var persistentSettings = { init: function(settings) { userSettings = settings; for (var i in settings) { + /* istanbul ignore else */ if (settings.hasOwnProperty(i)) { (function() { var j = i; @@ -51,7 +52,7 @@ var persistentSettings = { } return clone(globalSettings[prop]); }, - + set: function(prop,value) { if (userSettings.hasOwnProperty(prop)) { throw new Error("Property '"+prop+"' is read-only"); @@ -68,13 +69,14 @@ var persistentSettings = { return storage.saveSettings(globalSettings); } }, - + available: function() { return (globalSettings !== null); }, - + reset: function() { for (var i in userSettings) { + /* istanbul ignore else */ if (userSettings.hasOwnProperty(i)) { delete persistentSettings[i]; } diff --git a/test/red/api/info_spec.js b/test/red/api/info_spec.js index 0ac2f93e1..0e5b02451 100644 --- a/test/red/api/info_spec.js +++ b/test/red/api/info_spec.js @@ -30,17 +30,18 @@ describe("info api", function() { var userSettings = { foo: 123, httpNodeRoot: "testHttpNodeRoot", - version: "testVersion" + version: "testVersion", + paletteCategories :["red","blue","green"] } settings.init(userSettings); app = express(); app.get("/settings",info.settings); }); - + after(function() { settings.reset(); }); - + it('returns the filtered settings', function(done) { request(app) .get("/settings") diff --git a/test/red/log_spec.js b/test/red/log_spec.js index 0fb0aafd5..d2ed97094 100644 --- a/test/red/log_spec.js +++ b/test/red/log_spec.js @@ -19,4 +19,21 @@ describe("red/log", function() { it('can be required without errors', function() { require("../../red/log"); }); + + var log = require("../../red/log"); + + it('it can raise an error', function() { + var m = {level:20, msg:"This is an error", type:"test", id:"12345", name:"ERROR" }; + var ret = log.error(m); + }); + + it('it can raise a trace', function() { + var m = {level:60, msg:"This is a trace", type:"test", id:"12345", name:"TRACE" }; + var ret = log.trace(m); + }); + + it('it can raise a debug', function() { + var m = {level:50, msg:"This is a debug", type:"test", id:"12345", name:"DEBUG" }; + var ret = log.debug(m); + }); });