-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from kwakwaversal/init-settings
Add customisable userSettings
- Loading branch information
Showing
4 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var should = require("should"); | ||
var NodeTestHelper = require('../index.js').NodeTestHelper; | ||
|
||
var helper; | ||
beforeEach(function() { | ||
// .init() is implicitly called on instantiation so not required | ||
helper = new NodeTestHelper(); | ||
}); | ||
|
||
describe('add custom settings on init', function () { | ||
it('should merge custom settings with RED.settings defaults', function () { | ||
helper._settings.should.not.have.property('functionGlobalContext'); | ||
helper.init(null, {functionGlobalContext: {}}); | ||
helper._settings.should.have.property('functionGlobalContext'); | ||
}); | ||
}); | ||
|
||
describe('helper.settings() usage', function() { | ||
it('should return a settings Object', function() { | ||
var settings = helper.settings(); | ||
should.exist(settings); | ||
settings.should.have.property('get'); | ||
}); | ||
it('should not maintain settings state across multiple invocations', function() { | ||
helper.settings({ foo: true }).should.have.property('foo'); | ||
helper.settings({ bar: true }).should.not.have.property('foo'); | ||
}); | ||
}); |