mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
fix tests
This commit is contained in:
parent
c7df447589
commit
5a9d9feebb
@ -17,6 +17,7 @@ class AwsCompileAlexaSkillEvents {
|
||||
const functionObj = this.serverless.service.getFunction(functionName);
|
||||
|
||||
if (functionObj.events) {
|
||||
console.log(functionObj.events);
|
||||
functionObj.events.forEach(event => {
|
||||
if (event === 'alexaSkill') {
|
||||
const lambdaLogicalId = this.provider.naming
|
||||
@ -45,7 +46,7 @@ class AwsCompileAlexaSkillEvents {
|
||||
|
||||
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Resources,
|
||||
permissionCloudForamtionResource);
|
||||
} else {
|
||||
} else if (event.alexaSkill) {
|
||||
const errorMessage = [
|
||||
`Alexa Skill event of function "${functionName}" is not an object or string.`,
|
||||
' The correct syntax is: alexaSkill.',
|
||||
|
||||
@ -25,7 +25,7 @@ describe('AwsCompileAlexaSkillEvents', () => {
|
||||
});
|
||||
|
||||
describe('#compileAlexaSkillEvents()', () => {
|
||||
it('should throw an error if alexaSkill event type is not an object', () => {
|
||||
it('should throw an error if alexaSkill event is not an string', () => {
|
||||
awsCompileAlexaSkillEvents.serverless.service.functions = {
|
||||
first: {
|
||||
events: [
|
||||
@ -39,15 +39,11 @@ describe('AwsCompileAlexaSkillEvents', () => {
|
||||
expect(() => awsCompileAlexaSkillEvents.compileAlexaSkillEvents()).to.throw(Error);
|
||||
});
|
||||
|
||||
it('should create corresponding resources when event is given and enabled', () => {
|
||||
it('should create corresponding resources when a alexaSkill event is provided', () => {
|
||||
awsCompileAlexaSkillEvents.serverless.service.functions = {
|
||||
first: {
|
||||
events: [
|
||||
{
|
||||
alexaSkill: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
'alexaSkill',
|
||||
],
|
||||
},
|
||||
};
|
||||
@ -72,27 +68,6 @@ describe('AwsCompileAlexaSkillEvents', () => {
|
||||
).to.equal('alexa-appkit.amazon.com');
|
||||
});
|
||||
|
||||
it('should not create corresponding resources when event is given but not enabled', () => {
|
||||
awsCompileAlexaSkillEvents.serverless.service.functions = {
|
||||
first: {
|
||||
events: [
|
||||
{
|
||||
alexaSkill: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
awsCompileAlexaSkillEvents.compileAlexaSkillEvents();
|
||||
|
||||
expect(
|
||||
awsCompileAlexaSkillEvents.serverless.service.provider
|
||||
.compiledCloudFormationTemplate.Resources
|
||||
).to.deep.equal({});
|
||||
});
|
||||
|
||||
it('should not create corresponding resources when alexaSkill event is not given', () => {
|
||||
awsCompileAlexaSkillEvents.serverless.service.functions = {
|
||||
first: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user