Skip to content

Commit

Permalink
Remove shape checking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericbarthelet committed Sep 8, 2020
1 parent 1b96898 commit dc73240
Showing 1 changed file with 0 additions and 149 deletions.
149 changes: 0 additions & 149 deletions lib/plugins/aws/package/compile/events/stream/index.test.js
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit dc73240

Please sign in to comment.