mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
test coverage for loading variable getters
This commit is contained in:
parent
02fa190d0b
commit
e4d29bb9cd
@ -1048,6 +1048,26 @@ describe('PluginManager', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#loadVariableGetters()', () => {
|
||||
it('should load the plugin variable getters', () => {
|
||||
const getTestVariable = async () => 'testVariable'
|
||||
class VariableGetterPlugin {
|
||||
constructor(sls) {
|
||||
this.variableGetters = [[/^test:/, getTestVariable]]
|
||||
}
|
||||
}
|
||||
pluginManager.serverless.variables = {
|
||||
variableResolvers: [],
|
||||
customVariableResolverFuncs: {},
|
||||
}
|
||||
const pluginInstance = new VariableGetterPlugin();
|
||||
pluginManager.loadVariableGetters(pluginInstance);
|
||||
|
||||
expect(pluginManager.serverless.variables.variableResolvers).to.deep.equal([[/^test:/, 'getTestVariable']])
|
||||
expect(Object.keys(pluginManager.serverless.variables.customVariableResolverFuncs)).to.deep.equal(['getTestVariable'])
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getEvents()', () => {
|
||||
beforeEach(() => {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user