From 7768db7c910dcd4c00efbb787f3beb2d64794274 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Fri, 11 Nov 2016 13:38:15 +0100 Subject: [PATCH] Fix spacing in naming.js test file --- lib/plugins/aws/tests/naming.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/plugins/aws/tests/naming.js b/lib/plugins/aws/tests/naming.js index 7f4134d0a..a2bd86fd1 100644 --- a/lib/plugins/aws/tests/naming.js +++ b/lib/plugins/aws/tests/naming.js @@ -32,6 +32,7 @@ describe('#naming()', () => { expect(sdk.naming.normalizeName('nAME')).to.equal('NAME'); }); }); + describe('#normalizeNameToAlphaNumericOnly()', () => { it('should strip non-alpha-numeric characters', () => { expect(sdk.naming @@ -42,6 +43,7 @@ describe('#naming()', () => { expect(sdk.naming.normalizeNameToAlphaNumericOnly('a-b-c')).to.equal('Abc'); }); }); + describe('#normalizeNameToCapitalAlphaNumbericOnly()', () => { it('converts `-` to `Dash`', () => { expect(sdk.naming.normalizePathPart( @@ -73,6 +75,7 @@ describe('#naming()', () => { )).to.equal('PathvariableVarDir'); }); }); + describe('#getServiceEndpointRegex()', () => { it('should match the prefix', () => { expect(sdk.naming.getServiceEndpointRegex().test('ServiceEndpoint')) @@ -89,12 +92,14 @@ describe('#naming()', () => { .test('ServiceEndpointForAService')).to.equal(true); }); }); + describe('#getStackName()', () => { it('should use the service name and stage from the service and config', () => { serverless.service.service = 'myService'; expect(sdk.naming.getStackName()).to.equal(`${serverless.service.service}-${options.stage}`); }); }); + describe('#getNormalizedFunctionName()', () => { it('should normalize the given functionName', () => { expect(sdk.naming.getNormalizedFunctionName('functionName')) @@ -111,24 +116,28 @@ describe('#naming()', () => { .to.equal('HelloDashworld'); }); }); + describe('#extractAuthorizerNameFromArn()', () => { it('should extract everything after the last colon and dash', () => { const arn = 'arn:aws:lambda:us-east-1:0123456789:my-dev-lambda'; expect(sdk.naming.extractAuthorizerNameFromArn(arn)).to.equal('lambda'); }); }); + describe('#extractLambdaNameFromArn()', () => { it('should extract everything after the last colon', () => { const arn = 'arn:aws:lambda:us-east-1:0123456789:my-dev-lambda'; expect(sdk.naming.extractLambdaNameFromArn(arn)).to.equal('my-dev-lambda'); }); }); + describe('#getLambdaLogicalId()', () => { it('should normalize the function name and add the logical suffix', () => { expect(sdk.naming.getLambdaLogicalId('functionName')) .to.equal('FunctionNameLambdaFunction'); }); }); + describe('#getLambdaLogicalIdRegex()', () => { it('should match the suffix', () => { expect(sdk.naming.getLambdaLogicalIdRegex() @@ -145,6 +154,7 @@ describe('#naming()', () => { .test('AFunctionNameLambdaFunction')).to.equal(true); }); }); + describe('#getLambdaOutputLogicalId()', () => { it('should normalize the function name and add the logical arn suffix', () => { expect( @@ -152,6 +162,7 @@ describe('#naming()', () => { ).to.equal('FunctionNameLambdaFunctionArn'); }); }); + describe('#getLambdaOutputLogicalIdRegex()', () => { it('should match the suffix', () => { expect(sdk.naming.getLambdaOutputLogicalIdRegex() @@ -170,6 +181,7 @@ describe('#naming()', () => { .to.equal(true); }); }); + describe('#generateApiGatewayDeploymentLogicalId()', () => { it('should return ApiGatewayDeployment with a date based suffix', () => { expect(sdk.naming.generateApiGatewayDeploymentLogicalId() @@ -177,29 +189,34 @@ describe('#naming()', () => { .to.be.greaterThan(1); }); }); + describe('#getRestApiLogicalId()', () => { it('should return ApiGatewayRestApi', () => { expect(sdk.naming.getRestApiLogicalId()).to.equal('ApiGatewayRestApi'); }); }); + describe('#getNormalizedAuthorizerName()', () => { it('normalize the authorizer name', () => { expect(sdk.naming.getNormalizedAuthorizerName('authorizerName')) .to.equal('AuthorizerName'); }); }); + describe('#getAuthorizerLogicalId()', () => { it('should normalize the authorizer name and add the standard suffix', () => { expect(sdk.naming.getAuthorizerLogicalId('authorizerName')) .to.equal('AuthorizerNameApiGatewayAuthorizer'); }); }); + describe('#extractAuthorizerNameFromArn()', () => { it('should extract the authorizer name from an ARN', () => { const arn = 'arn:aws:lambda:us-east-1:0123456789:my-dev-lambda'; expect(sdk.naming.extractAuthorizerNameFromArn(arn)).to.equal('lambda'); }); }); + describe('#normalizePath()', () => { it('should normalize each part of the resource path and remove non-alpha-numeric characters', () => { @@ -208,6 +225,7 @@ describe('#naming()', () => { )).to.equal('MyPathToADashvarVarDashresource'); }); }); + describe('#getResourceLogicalId()', () => { it('should normalize the resource and add the standard suffix', () => { expect(sdk.naming.getResourceLogicalId( @@ -215,6 +233,7 @@ describe('#naming()', () => { )).to.equal('ApiGatewayResourceMyPathToADashvarVarDashresource'); }); }); + describe('#extractResourceId()', () => { it('should extract the normalized resource name', () => { expect(sdk.naming.extractResourceId( @@ -222,11 +241,13 @@ describe('#naming()', () => { )).to.equal('MyPathToADashvarVarDashResource'); }); }); + describe('#normalizeMethodName()', () => { it('should capitalize the first letter and lowercase any other characters', () => { expect(sdk.naming.normalizeMethodName('gET')).to.equal('Get'); }); }); + describe('#getMethodLogicalId()', () => { it('', () => { expect(sdk.naming.getMethodLogicalId( @@ -234,6 +255,7 @@ describe('#naming()', () => { )).to.equal('ApiGatewayMethodResourceIdGet'); }); }); + describe('#getApiKeyLogicalIdRegex()', () => { it('should match the prefix', () => { expect(sdk.naming.getApiKeyLogicalIdRegex() @@ -256,49 +278,58 @@ describe('#naming()', () => { expect(sdk.naming.getDeploymentBucketLogicalId()).to.equal('ServerlessDeploymentBucket'); }); }); + describe('#getDeploymentBucketOutputLogicalId()', () => { it('should return "ServerlessDeploymentBucketName"', () => { expect(sdk.naming.getDeploymentBucketOutputLogicalId()) .to.equal('ServerlessDeploymentBucketName'); }); }); + describe('#normalizeBucketName()', () => { it('should remove all non-alpha-numeric characters and capitalize the first letter', () => { expect(sdk.naming.normalizeBucketName('b!u@c#k$e%t^N&a*m(e')).to.equal('BucketName'); }); }); + describe('#getBucketLogicalId()', () => { it('should normalize the bucket name and add the standard prefix', () => { expect(sdk.naming.getBucketLogicalId('b!u@c#k$e%t^N&a*m(e')).to.equal('S3BucketBucketName'); }); }); + describe('#normalizeTopicName()', () => { it('should remove all non-alpha-numeric characters and capitalize the first letter', () => { expect(sdk.naming.normalizeTopicName('t!o@p#i$c%N^a&m*e')).to.equal('TopicName'); }); }); + describe('#getTopicLogicalId()', () => { it('should remove all non-alpha-numeric characters and capitalize the first letter', () => { expect(sdk.naming.getTopicLogicalId('t!o@p#i$c%N^a&m*e')).to.equal('SNSTopicTopicName'); }); }); + describe('#getScheduleId()', () => { it('should add the standard suffix', () => { expect(sdk.naming.getScheduleId('functionName')).to.equal('functionNameSchedule'); }); }); + describe('#getScheduleLogicalId()', () => { it('should normalize the function name and add the standard suffix including the index', () => { expect(sdk.naming.getScheduleLogicalId('functionName', 0)) .to.equal('FunctionNameEventsRuleSchedule0'); }); }); + describe('#getLambdaS3PermissionLogicalId()', () => { it('should normalize the function name and add the standard suffix', () => { expect(sdk.naming.getLambdaS3PermissionLogicalId('functionName')) .to.equal('FunctionNameLambdaPermissionS3'); }); }); + describe('#getLambdaSnsPermissionLogicalId()', () => { it('should normalize the function and topic names and add them as prefix and suffix to the ' + 'standard permission center', () => { @@ -306,6 +337,7 @@ describe('#naming()', () => { .to.equal('FunctionNameLambdaPermissionTopicName'); }); }); + describe('#getLambdaSchedulePermissionLogicalId()', () => { it('should normalize the function name and add the standard suffix including event index', () => { @@ -313,6 +345,7 @@ describe('#naming()', () => { .to.equal('FunctionNameLambdaPermissionEventsRuleSchedule0'); }); }); + describe('#getLambdaApiGatewayPermissionLogicalId()', () => { it('should normalize the function name and append the standard suffix', () => { expect(sdk.naming.getLambdaApiGatewayPermissionLogicalId('functionName'))