From 19a831aefa1f00f127f4374e916646df473518e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barthelet?= Date: Tue, 15 Sep 2020 16:29:55 +0200 Subject: [PATCH] Remove unecessary tests --- .../package/compile/functions/index.test.js | 125 ------------------ 1 file changed, 125 deletions(-) diff --git a/lib/plugins/aws/package/compile/functions/index.test.js b/lib/plugins/aws/package/compile/functions/index.test.js index 60f7e1a0be69..e058bf92871d 100644 --- a/lib/plugins/aws/package/compile/functions/index.test.js +++ b/lib/plugins/aws/package/compile/functions/index.test.js @@ -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 @@ -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: { @@ -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' - ); - }); }); }); @@ -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: { @@ -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', @@ -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: {