liudong
2023-05-29 340f156319b863525e50e900c58e59b86ecb3d5e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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');
  });
});