Remove event passing for icons/examples from the api layer

This commit is contained in:
Nick O'Leary
2017-02-15 22:54:32 +00:00
parent 702e6d3b51
commit 869fdbcc6a
12 changed files with 291 additions and 149 deletions

View File

@@ -17,6 +17,7 @@
var should = require("should");
var when = require("when");
var sinon = require("sinon");
var path = require("path");
var typeRegistry = require("../../../../../red/runtime/nodes/registry/registry");
@@ -483,4 +484,19 @@ describe("red/nodes/registry/registry",function() {
});
});
describe('#getNodeIconPath', function() {
it('returns the default icon when getting an unknown icon', function() {
var defaultIcon = path.resolve(__dirname+'/../../../../../public/icons/arrow-in.png');
var iconPath = typeRegistry.getNodeIconPath('random-module','youwonthaveme.png');
iconPath.should.eql(defaultIcon);
});
it('returns a registered icon' , function() {
var testIcon = path.resolve(__dirname+'/../../../../resources/icons/test_icon.png');
events.emit("node-icon-dir",{name:"test-module", path: path.resolve(__dirname+'/../../../../resources/icons')});
var iconPath = typeRegistry.getNodeIconPath('test-module','test_icon.png');
iconPath.should.eql(testIcon);
});
});
});