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) {
throw new Error("Settings not available");
}
var current = globalSettings[prop];
globalSettings[prop] = value;
var current = persistentSettings.get(prop);
try {
assert.deepEqual(current,value);
return when.resolve();
@ -72,6 +72,12 @@ var persistentSettings = {
available: function() {
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() {
afterEach(function() {
settings.reset();
});
it('wraps the user settings as read-only properties', function() {
var userSettings = {
a: 123,