diff --git a/lib/plugins/aws/package/compile/events/stream/index.test.js b/lib/plugins/aws/package/compile/events/stream/index.test.js index 3aea66372e1b..bc66067b53e5 100644 --- a/lib/plugins/aws/package/compile/events/stream/index.test.js +++ b/lib/plugins/aws/package/compile/events/stream/index.test.js @@ -83,22 +83,6 @@ describe('AwsCompileStreamEvents', () => { expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); }); - it('should throw an error if the "arn" property contains an unsupported stream type', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - arn: 'arn:aws:NOT-SUPPORTED:us-east-1:123456789012:stream/myStream', - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - it('should not throw error or merge role statements if default policy is not present', () => { awsCompileStreamEvents.serverless.service.functions = { first: { @@ -990,96 +974,6 @@ describe('AwsCompileStreamEvents', () => { expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); }); - it('fails if keys other than Fn::GetAtt/ImportValue/Join are used for dynamic stream ARN', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - type: 'dynamodb', - arn: { - 'Fn::GetAtt': ['SomeDdbTable', 'StreamArn'], - 'batchSize': 1, - }, - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - - it('fails if keys other than Fn::GetAtt/ImportValue/Join are used for dynamic onFailure ARN', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - arn: 'arn:aws:dynamodb:region:account:table/foo/stream/1', - destinations: { - onFailure: { - arn: { - 'Fn::GetAtt': ['SomeSNS', 'Arn'], - 'batchSize': 1, - }, - type: 'sns', - }, - }, - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - - it('fails if Fn::ImportValue is misused for onFailure ARN', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - arn: 'arn:aws:dynamodb:region:account:table/foo/stream/1', - destinations: { - onFailure: { - arn: { - 'Fn::ImportValue': { - 'Fn::GetAtt': ['SomeSNS', 'Arn'], - }, - }, - type: 'invalidType', - }, - }, - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - - it('fails if onFailure ARN is given as a string that does not start with arn', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - arn: 'arn:aws:dynamodb:region:account:table/foo/stream/1', - destinations: { - onFailure: 'invalidARN', - }, - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - it('fails if onFailure ARN is given as a variable type other than string or object', () => { awsCompileStreamEvents.serverless.service.functions = { first: { @@ -1099,27 +993,6 @@ describe('AwsCompileStreamEvents', () => { expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); }); - it('fails if nested onFailure ARN is given as a string that does not start with arn', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - arn: 'arn:aws:dynamodb:region:account:table/foo/stream/1', - destinations: { - onFailure: { - arn: 'invalidARN', - }, - }, - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - it('fails if no arn key is given for a dynamic onFailure ARN', () => { awsCompileStreamEvents.serverless.service.functions = { first: { @@ -1165,28 +1038,6 @@ describe('AwsCompileStreamEvents', () => { expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); }); - it('fails if invalid onFailure type is given', () => { - awsCompileStreamEvents.serverless.service.functions = { - first: { - events: [ - { - stream: { - arn: 'arn:aws:dynamodb:region:account:table/foo/stream/1', - destinations: { - onFailure: { - arn: { 'Fn::GetAtt': ['SomeSNS', 'Arn'] }, - type: 'invalidType', - }, - }, - }, - }, - ], - }, - }; - - expect(() => awsCompileStreamEvents.compileStreamEvents()).to.throw(Error); - }); - it('should add the necessary IAM role statements', () => { awsCompileStreamEvents.serverless.service.functions = { first: {