Adapt test after modification to uninstallModule

This commit is contained in:
Ralph Wetzel 2023-10-18 08:04:52 +02:00
parent 81937ddc45
commit 3275a76fb0

View File

@ -25,6 +25,7 @@ var NR_TEST_UTILS = require("nr-test-utils");
var installer = NR_TEST_UTILS.require("@node-red/registry/lib/installer"); var installer = NR_TEST_UTILS.require("@node-red/registry/lib/installer");
var registry = NR_TEST_UTILS.require("@node-red/registry/lib/index"); var registry = NR_TEST_UTILS.require("@node-red/registry/lib/index");
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry/lib/registry"); var typeRegistry = NR_TEST_UTILS.require("@node-red/registry/lib/registry");
let pluginRegistry = NR_TEST_UTILS.require("@node-red/registry/lib/plugins");
const { events, exec, log, hooks } = NR_TEST_UTILS.require("@node-red/util"); const { events, exec, log, hooks } = NR_TEST_UTILS.require("@node-red/util");
describe('nodes/registry/installer', function() { describe('nodes/registry/installer', function() {
@ -66,6 +67,9 @@ describe('nodes/registry/installer', function() {
if (typeRegistry.setModulePendingUpdated.restore) { if (typeRegistry.setModulePendingUpdated.restore) {
typeRegistry.setModulePendingUpdated.restore(); typeRegistry.setModulePendingUpdated.restore();
} }
if (pluginRegistry.removeModule.restore) {
pluginRegistry.removeModule.restore();
}
if (fs.statSync.restore) { if (fs.statSync.restore) {
fs.statSync.restore(); fs.statSync.restore();
} }
@ -502,6 +506,9 @@ describe('nodes/registry/installer', function() {
var removeModule = sinon.stub(typeRegistry,"removeModule").callsFake(function(md) { var removeModule = sinon.stub(typeRegistry,"removeModule").callsFake(function(md) {
return nodeInfo; return nodeInfo;
}); });
let removePluginModule = sinon.stub(pluginRegistry,"removeModule").callsFake(function(md) {
return [];
});
var getModuleInfo = sinon.stub(registry,"getModuleInfo").callsFake(function(md) { var getModuleInfo = sinon.stub(registry,"getModuleInfo").callsFake(function(md) {
return {nodes:[]}; return {nodes:[]};
}); });