Improve tests

This commit is contained in:
Mariusz Nowak 2019-10-08 13:15:54 +02:00
parent caae1d237e
commit c68c085290
No known key found for this signature in database
GPG Key ID: B1FBDA8A182B03F2

View File

@ -629,14 +629,16 @@ describe('PluginManager', () => {
it('should throw an error when trying to load unknown plugin', () => {
const servicePlugins = ['ServicePluginMock3', 'ServicePluginMock1'];
expect(() => pluginManager.loadPlugins(servicePlugins)).to.throw(serverless.classes.Error);
expect(() => pluginManager.loadServicePlugins(servicePlugins)).to.throw(
serverless.classes.Error
);
});
it('should not throw error when trying to load unknown plugin with help flag', () => {
const servicePlugins = ['ServicePluginMock3', 'ServicePluginMock1'];
pluginManager.setCliOptions({ help: true });
pluginManager.loadPlugins(servicePlugins);
pluginManager.loadServicePlugins(servicePlugins);
expect(() => pluginManager.loadPlugins(servicePlugins)).to.not.throw(
serverless.classes.Error
@ -646,7 +648,7 @@ describe('PluginManager', () => {
it('should pass through an error when trying to load a broken plugin', () => {
const servicePlugins = ['BrokenPluginMock'];
expect(() => pluginManager.loadPlugins(servicePlugins)).to.throw(brokenPluginError);
expect(() => pluginManager.loadServicePlugins(servicePlugins)).to.throw(brokenPluginError);
});
it('should not throw error when running the plugin commands and given plugins does not exist', () => {
@ -654,7 +656,7 @@ describe('PluginManager', () => {
const cliCommandsMock = ['plugin'];
pluginManager.setCliCommands(cliCommandsMock);
expect(() => pluginManager.loadPlugins(servicePlugins)).to.not.throw(
expect(() => pluginManager.loadServicePlugins(servicePlugins)).to.not.throw(
serverless.classes.Error
);
});