Added unit test for getCommands()

This commit is contained in:
Frank Schmid 2017-06-07 17:44:18 +02:00
parent b73466641e
commit 6bbe0b01f5

View File

@ -240,6 +240,13 @@ describe('PluginManager', () => {
'event2',
],
},
spawnep: {
type: 'entrypoint',
lifecycleEvents: [
'event1',
'event2',
],
},
},
},
@ -1070,6 +1077,21 @@ describe('PluginManager', () => {
});
});
describe('#getCommands()', () => {
it('should hide entrypoints on any level and only return commands', () => {
pluginManager.addPlugin(EntrypointPluginMock);
const commands = pluginManager.getCommands();
expect(commands).to.have.a.property('mycmd');
expect(commands).to.have.a.deep.property('mycmd.commands.mysubcmd');
expect(commands).to.have.a.deep.property('mycmd.commands.spawncmd');
// Check for omitted entrypoints
expect(commands).to.not.have.a.property('myep');
expect(commands).to.not.have.a.deep.property('myep.commands.mysubep');
expect(commands).to.not.have.a.deep.property('mycmd.commands.spawnep');
});
});
describe('#spawn()', () => {
it('should throw an error when the given command is not available', () => {
pluginManager.addPlugin(EntrypointPluginMock);