Improve processing when default is an alias

and fix test cases
This commit is contained in:
Hiroki Uchikawa
2018-04-23 10:45:30 +09:00
committed by HirokiUchikawa
parent e046fc1ac5
commit 0be9c88106
4 changed files with 14 additions and 12 deletions

View File

@@ -79,6 +79,7 @@ describe("runtime", function() {
var redNodesGetNodeList;
var redNodesLoadFlows;
var redNodesStartFlows;
var redNodesLoadContextsPlugin;
beforeEach(function() {
storageInit = sinon.stub(storage,"init",function(settings) {return when.resolve();});
@@ -91,6 +92,7 @@ describe("runtime", function() {
redNodesCleanModuleList = sinon.stub(redNodes,"cleanModuleList",function(){});
redNodesLoadFlows = sinon.stub(redNodes,"loadFlows",function() {return when.resolve()});
redNodesStartFlows = sinon.stub(redNodes,"startFlows",function() {});
redNodesLoadContextsPlugin = sinon.stub(redNodes,"loadContextsPlugin",function() {});
});
afterEach(function() {
storageInit.restore();
@@ -104,6 +106,7 @@ describe("runtime", function() {
redNodesCleanModuleList.restore();
redNodesLoadFlows.restore();
redNodesStartFlows.restore();
redNodesLoadContextsPlugin.restore();
});
it("reports errored/missing modules",function(done) {
redNodesGetNodeList = sinon.stub(redNodes,"getNodeList", function(cb) {

View File

@@ -123,7 +123,7 @@ describe('context', function() {
should.not.exist(context.get("foo"));
});
it.skip('enumerates context keys', function() {
it('enumerates context keys', function() {
var context = Context.get("1","flowA");
var keys = context.keys();
@@ -168,6 +168,7 @@ describe('context', function() {
stubGet.reset();
stubSet.reset();
stubKeys.reset();
stubDelete.reset();
Context.clean({allNodes:{}});
fs.remove(testDir,done);
});
@@ -418,7 +419,7 @@ describe('context', function() {
var result = parseKey(input);
result.storage.should.eql(expectedModule);
result.key.should.eql(expectedKey);
};
}
it('should return module and key', function() {
returnModuleAndKey("$test.aaa","test","aaa");

View File

@@ -153,11 +153,9 @@ describe("red/util", function() {
var v = util.getMessageProperty({a:"foo"},"msg.b");
should.not.exist(v);
});
it('should throw error if property parent does not exist', function() {
/*jshint immed: false */
(function() {
util.getMessageProperty({a:"foo"},"msg.a.b.c");
}).should.throw();
it('should return undefined if property parent does not exist', function() {
var v = util.getMessageProperty({a:"foo"},"msg.a.b.c");
should.not.exist(v);
});
it('retrieves a property with array syntax', function() {
var v = util.getMessageProperty({a:["foo","bar"]},"msg.a[0]");