serverless-dynamodb-autoscaling
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "serverless-dynamodb-autoscaling", | ||
"description": "Serverless Plugin for Amazon DynamoDB Auto Scaling configuration.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "src/plugin.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -19,3 +19,3 @@ # ⚡️ Serverless Plugin for DynamoDB Auto Scaling | ||
# Via npm | ||
$ npm install serverless-dynamodb-autoscaling --save | ||
$ npm install serverless-dynamodb-autoscaling --save-dev | ||
``` | ||
@@ -22,0 +22,0 @@ |
const util = require('util') | ||
const clean = (input) => input.replace(/\W/g, '') | ||
const clean = (input) => input.replace(/[^a-z0-9+]+/gi, '') | ||
@@ -12,2 +12,2 @@ const policyScale = (table, read) => clean(util.format('Table%sScalingPolicy-%s', read ? 'Read' : 'Write', table)) | ||
module.exports = { dimension, metric, policyScale, policyRole, role, target } | ||
module.exports = { dimension, metric, policyScale, policyRole, role, target, clean } |
@@ -61,3 +61,3 @@ 'use strict' | ||
this.serverless.cli.log( | ||
util.format(' - Building configuration for table "%s"', table.name) | ||
util.format(' - Adding configuration for table "%s"', table.name) | ||
) | ||
@@ -91,4 +91,2 @@ | ||
) | ||
this.serverless.cli.log(' Done.') | ||
} | ||
@@ -95,0 +93,0 @@ ) |
const names = require('../../src/aws/names') | ||
describe('Clean', () => { | ||
it('removes non alphanumeric characters', () => { | ||
expect(names.clean('a-b-c')).toBe('abc') | ||
expect(names.clean('a-b_c')).toBe('abc') | ||
expect(names.clean('A-b_9')).toBe('Ab9') | ||
expect(names.clean('A/b*9')).toBe('Ab9') | ||
expect(names.clean('Ä-ç_9')).toBe('9') | ||
}) | ||
}) | ||
describe('Names', () => { | ||
@@ -4,0 +14,0 @@ it('creates name for Role', () => { |
120081
371