mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Added unit test for getCommands()
This commit is contained in:
parent
b73466641e
commit
6bbe0b01f5
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user