Skip to content

Commit

Permalink
Remove unecessary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericbarthelet committed Sep 15, 2020
1 parent cfc1857 commit 19a831a
Showing 1 changed file with 0 additions and 125 deletions.
125 changes: 0 additions & 125 deletions lib/plugins/aws/package/compile/functions/index.test.js
Expand Up @@ -764,49 +764,6 @@ describe('AwsCompileFunctions', () => {
let s3Folder;
let s3FileName;

beforeEach(() => {
s3Folder = awsCompileFunctions.serverless.service.package.artifactDirectoryName;
s3FileName = awsCompileFunctions.serverless.service.package.artifact.split(path.sep).pop();
});

it('should reject if config is provided as a number', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
onError: 12,
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(Error);
});

it('should reject if config is provided as an object', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
onError: {
foo: 'bar',
},
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(Error);
});

it('should reject if config is not a SNS or SQS arn', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
onError: 'foo',
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(Error);
});

describe('when IamRoleLambdaExecution is used', () => {
beforeEach(() => {
// pretend that the IamRoleLambdaExecution is used
Expand Down Expand Up @@ -872,20 +829,6 @@ describe('AwsCompileFunctions', () => {
});
});

it('should throw an informative error message if a SQS arn is provided', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
onError: 'arn:aws:sqs:region:accountid:foo',
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(
'only supports SNS'
);
});

it('should create necessary resources if a Ref is provided', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
Expand Down Expand Up @@ -1052,20 +995,6 @@ describe('AwsCompileFunctions', () => {
expect(functionResource).to.deep.equal(compiledFunction);
});
});

it('should reject with an informative error message if a SQS arn is provided', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
onError: 'arn:aws:sqs:region:accountid:foo',
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(
'only supports SNS'
);
});
});
});

Expand All @@ -1078,20 +1007,6 @@ describe('AwsCompileFunctions', () => {
s3FileName = awsCompileFunctions.serverless.service.package.artifact.split(path.sep).pop();
});

it('should reject if config is provided as a number', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
awsKmsKeyArn: 12,
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(
'provided as an arn string'
);
});

it('should allow if config is provided as a Fn::GetAtt', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
Expand Down Expand Up @@ -1203,34 +1118,6 @@ describe('AwsCompileFunctions', () => {
});
});

it('should reject if config is provided as an invalid object', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
awsKmsKeyArn: {
foo: 'bar',
},
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith(
'provided as an arn string'
);
});

it('should throw an error if config is not a KMS key arn', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
awsKmsKeyArn: 'foo',
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith('KMS key arn');
});

it('should use a the service KMS key arn if provided', () => {
awsCompileFunctions.serverless.service.serviceObject = {
name: 'new-service',
Expand Down Expand Up @@ -1448,18 +1335,6 @@ describe('AwsCompileFunctions', () => {
s3FileName = awsCompileFunctions.serverless.service.package.artifact.split(path.sep).pop();
});

it('should throw an error if config paramter is not a string', () => {
awsCompileFunctions.serverless.service.functions = {
func: {
handler: 'func.function.handler',
name: 'new-service-dev-func',
tracing: 123,
},
};

return expect(awsCompileFunctions.compileFunctions()).to.be.rejectedWith('as a string');
});

it('should use a the provider wide tracing config if provided', () => {
Object.assign(awsCompileFunctions.serverless.service.provider, {
tracing: {
Expand Down

0 comments on commit 19a831a

Please sign in to comment.