1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Reset settings between tests

This commit is contained in:
Nick O'Leary 2014-10-03 15:05:37 +01:00
parent c223e7f58f
commit 489c552dbe
2 changed files with 12 additions and 1 deletions

View File

@ -60,8 +60,8 @@ var persistentSettings = {
if (globalSettings === null) { if (globalSettings === null) {
throw new Error("Settings not available"); throw new Error("Settings not available");
} }
var current = globalSettings[prop];
globalSettings[prop] = value; globalSettings[prop] = value;
var current = persistentSettings.get(prop);
try { try {
assert.deepEqual(current,value); assert.deepEqual(current,value);
return when.resolve(); return when.resolve();
@ -72,6 +72,12 @@ var persistentSettings = {
available: function() { available: function() {
return (globalSettings !== null); return (globalSettings !== null);
},
reset: function() {
userSettings = null;
globalSettings = null;
storage = null;
} }
} }

View File

@ -20,6 +20,11 @@ var settings = require("../../red/settings");
describe("red/settings", function() { describe("red/settings", function() {
afterEach(function() {
settings.reset();
});
it('wraps the user settings as read-only properties', function() { it('wraps the user settings as read-only properties', function() {
var userSettings = { var userSettings = {
a: 123, a: 123,