mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add node module update api and expose in palette editor
This commit is contained in:
@@ -46,6 +46,9 @@ describe('nodes/registry/installer', function() {
|
||||
if (registry.getModuleInfo.restore) {
|
||||
registry.getModuleInfo.restore();
|
||||
}
|
||||
if (typeRegistry.getModuleInfo.restore) {
|
||||
typeRegistry.getModuleInfo.restore();
|
||||
}
|
||||
|
||||
if (require('fs').statSync.restore) {
|
||||
require('fs').statSync.restore();
|
||||
@@ -64,6 +67,32 @@ describe('nodes/registry/installer', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("rejects when npm does not find specified version", function(done) {
|
||||
sinon.stub(child_process,"execFile",function(cmd,args,opt,cb) {
|
||||
cb(new Error(),""," version not found: this_wont_exist@0.1.2");
|
||||
});
|
||||
sinon.stub(typeRegistry,"getModuleInfo", function() {
|
||||
return {
|
||||
version: "0.1.1"
|
||||
}
|
||||
});
|
||||
|
||||
installer.installModule("this_wont_exist","0.1.2").otherwise(function(err) {
|
||||
err.code.should.be.eql(404);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("rejects when update requested to existing version", function(done) {
|
||||
sinon.stub(typeRegistry,"getModuleInfo", function() {
|
||||
return {
|
||||
version: "0.1.1"
|
||||
}
|
||||
});
|
||||
installer.installModule("this_wont_exist","0.1.1").otherwise(function(err) {
|
||||
err.code.should.be.eql('module_already_loaded');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("rejects with generic error", function(done) {
|
||||
sinon.stub(child_process,"execFile",function(cmd,args,opt,cb) {
|
||||
cb(new Error("test_error"),"","");
|
||||
|
Reference in New Issue
Block a user