From cb1604ca89a077ffdb86127884292d3b18c8b4df Mon Sep 17 00:00:00 2001 From: Jonathan Stewmon Date: Mon, 21 Jan 2019 18:00:46 -0600 Subject: [PATCH] fix: update eslint, enforce semi, apply to test dir (#2336) --- .eslintignore | 2 + .eslintrc | 4 +- dist-tools/client-creator.js | 8 +- dist-tools/create-all-services.js | 2 +- dist-tools/service-collector.js | 2 +- dist-tools/webpack.config.rn-core.js | 2 +- dist-tools/webpack.config.rn-dep.js | 2 +- dist-tools/webpack.config.rn.js | 2 +- lib/browser.js | 2 +- lib/browserCryptoLib.js | 2 +- lib/browserHashUtils.js | 2 +- lib/browserHmac.js | 2 +- lib/browserSha1.js | 2 +- lib/cloudfront/signer.js | 4 +- .../chainable_temporary_credentials.js | 2 +- lib/discover_endpoint.js | 6 +- lib/dynamodb/numberValue.js | 2 +- lib/empty.js | 2 +- lib/event-stream/alloc-buffer.js | 2 +- .../buffered-create-event-stream.js | 2 +- lib/event-stream/build-message.js | 2 +- .../event-message-chunker-stream.js | 4 +- lib/event-stream/event-message-chunker.js | 2 +- .../event-message-unmarshaller-stream.js | 2 +- lib/event-stream/int64.js | 4 +- lib/event-stream/parse-event.js | 2 +- lib/event-stream/parse-message.js | 2 +- lib/event-stream/split-message.js | 2 +- .../streaming-create-event-stream.js | 2 +- lib/event-stream/to-buffer.js | 2 +- lib/event_listeners.js | 10 +- lib/http.js | 2 +- lib/param_validator.js | 2 +- lib/protocol/helpers.js | 8 +- lib/publisher/index.js | 12 +- lib/publisher/string-to-buffer.js | 2 +- lib/rds/signer.js | 2 +- lib/react-native/add-content-type.js | 2 +- lib/realclock/browserClock.js | 2 +- lib/realclock/nodeClock.js | 2 +- lib/sequential_executor.js | 2 +- lib/service.js | 14 +- lib/services/cloudsearchdomain.js | 14 +- lib/services/polly.js | 2 +- lib/services/rds.js | 2 +- lib/shared-ini/index.js | 2 +- lib/shared-ini/ini-loader.js | 4 +- lib/xml/browser_parser.js | 2 +- lib/xml/builder.js | 4 +- lib/xml/escape-attribute.js | 2 +- lib/xml/escape-element.js | 2 +- lib/xml/xml-node.js | 2 +- lib/xml/xml-text.js | 2 +- package.json | 8 +- test/.eslintrc | 6 + test/browser.spec.js | 6 +- test/browserHashes/hashes.spec.js | 4 +- test/clients.spec.js | 2 +- test/config.spec.js | 18 +- test/credential_provider_chain.spec.js | 16 +- test/credentials.spec.js | 98 +- test/discover_endpoint.spec.js | 130 +- test/dynamodb/converter.spec.js | 2 +- test/dynamodb/document_client.spec.js | 16 +- test/dynamodb/numberValue.spec.js | 2 +- test/endpoint.spec.js | 4 +- .../buffered-create-event-stream.spec.js | 2 +- .../event-message-chunker-stream.spec.js | 2 +- .../event-message-chunker.spec.js | 2 +- .../event-message-unmarshaller-stream.spec.js | 2 +- test/event-stream/int64.spec.js | 6 +- ...ock-event-message-source-stream.fixture.js | 2 +- test/event-stream/parse-event.spec.js | 2 +- test/event-stream/parse-message.spec.js | 2 +- .../scripts/build-test-vectors-fixture.js | 9 +- test/event-stream/split-message.spec.js | 4 +- .../streaming-create-event-stream.spec.js | 6 +- .../test-event-messages.fixture.js | 2 +- .../test-event-stream-model.fixture.js | 2 +- test/event_listeners.spec.js | 74 +- test/foo-service.fixture.js | 62 +- test/helpers.js | 4 +- test/http_request.spec.js | 6 +- test/idempotent.spec.js | 2 +- test/json/builder.spec.js | 6 +- test/json/parser.spec.js | 6 +- test/metadata_service.spec.js | 4 +- test/mocks/shaky-stream.js | 2 +- test/model/api.spec.js | 2 +- test/model/shape.spec.js | 2 +- test/node_http_client.spec.js | 6 +- test/param_validator.spec.js | 38 +- test/polly/presigner.spec.js | 4 +- test/protocol/helpers.spec.js | 58 +- test/protocol/protocol.spec.js | 4 +- test/protocol/query.spec.js | 24 +- test/protocol/rest.spec.js | 8 +- test/protocol/rest_xml.spec.js | 16 +- test/publisher/configuration.spec.js | 50 +- test/publisher/functional_test/cases.js | 1622 ++++++++--------- test/publisher/functional_test/runner.spec.js | 22 +- .../functional_test/utils/mock_agent.js | 8 +- .../functional_test/utils/mock_http_client.js | 10 +- .../functional_test/utils/validateEvents.js | 24 +- test/rds/signer.spec.js | 28 +- test/react-native/add-content-type.spec.js | 2 +- test/react-native/util.spec.js | 2 +- test/request.spec.js | 48 +- test/resource_waiter.spec.js | 18 +- test/response.spec.js | 4 +- test/s3/managed_upload.spec.js | 18 +- test/s3/virtual-host.fixture.js | 2 +- test/sequential_executor.spec.js | 12 +- test/service.spec.js | 84 +- test/services/apigateway.spec.js | 14 +- test/services/cloudfront.spec.js | 4 +- test/services/cloudsearchdomain.spec.js | 4 +- test/services/dynamodb.spec.js | 10 +- test/services/ec2.spec.js | 2 +- test/services/rds.spec.js | 2 +- test/services/route53.spec.js | 6 +- test/services/s3.spec.js | 68 +- test/services/s3control.spec.js | 22 +- test/services/sqs.spec.js | 6 +- test/shared_ini.spec.js | 32 +- test/signers/presign.spec.js | 4 +- test/signers/s3.spec.js | 34 +- test/signers/v4.spec.js | 8 +- test/util.spec.js | 48 +- test/xml/builder.spec.js | 60 +- test/xml/escape-attribute.spec.js | 2 +- test/xml/escape-element.spec.js | 2 +- test/xml/parser.spec.js | 62 +- test/xml/xml-node.spec.js | 2 +- test/xml/xml-text.spec.js | 2 +- 135 files changed, 1608 insertions(+), 1599 deletions(-) create mode 100644 .eslintignore create mode 100644 test/.eslintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..cf99a38ef9 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +dist/* +test/browser/**/* diff --git a/.eslintrc b/.eslintrc index df316268fe..bf4fe254fa 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,13 +10,15 @@ "rules": { "quotes": [2, "single"], "strict": 0, + "eol-last": ["error", "always"], "curly": 0, "no-empty": 0, "no-underscore-dangle": 0, "new-cap": 0, "dot-notation": 0, "no-use-before-define": 0, - "space-after-keywords": [2, "always"], + "semi": [2, "always"], + "keyword-spacing": [2, {"before": true, "after": true}], "space-before-blocks": [2, "always"], "no-trailing-spaces": 2, "space-unary-ops": 0 diff --git a/dist-tools/client-creator.js b/dist-tools/client-creator.js index 9fe3fb5711..156089ef9e 100644 --- a/dist-tools/client-creator.js +++ b/dist-tools/client-creator.js @@ -105,7 +105,7 @@ ClientCreator.prototype.generateClientFileSource = function generateClientFileSo } code += 'Object.defineProperty(apiLoader.services[\'' + serviceName +'\'], \'' + version + '\', {\n'; code += tab + 'get: function get() {\n'; - code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n' + code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n'; if (versionInfo.hasOwnProperty('paginators')) { code += tab + tab + 'model.paginators = require(\'../apis/' + versionInfo.paginators + '.json\').pagination;\n'; } @@ -125,7 +125,7 @@ ClientCreator.prototype.generateClientFileSource = function generateClientFileSo code: code, path: path.join(clientFolderPath, serviceName + '.js'), service: serviceName, - } + }; }; ClientCreator.prototype.tabs = function tabs(count) { @@ -134,7 +134,7 @@ ClientCreator.prototype.tabs = function tabs(count) { tab += ' '; } return tab; -} +}; ClientCreator.prototype.generateDefinePropertySource = function generateDefinePropertySource(objName, serviceName, className) { var tabs = this.tabs; @@ -211,4 +211,4 @@ ClientCreator.prototype.writeClientServices = function writeClientServices() { fs.writeFileSync(browserClientInfo.path, browserClientInfo.code); }; -module.exports = ClientCreator; \ No newline at end of file +module.exports = ClientCreator; diff --git a/dist-tools/create-all-services.js b/dist-tools/create-all-services.js index 8549b4c03e..fdf00c8213 100644 --- a/dist-tools/create-all-services.js +++ b/dist-tools/create-all-services.js @@ -3,4 +3,4 @@ var ClientCreator = require('./client-creator'); var cc = new ClientCreator(); cc.writeClientServices(); -console.log('Finished updating services.'); \ No newline at end of file +console.log('Finished updating services.'); diff --git a/dist-tools/service-collector.js b/dist-tools/service-collector.js index b0a4b61191..0b09a4141d 100644 --- a/dist-tools/service-collector.js +++ b/dist-tools/service-collector.js @@ -165,4 +165,4 @@ function ServiceCollector(services) { return serviceCode; } -module.exports = ServiceCollector; \ No newline at end of file +module.exports = ServiceCollector; diff --git a/dist-tools/webpack.config.rn-core.js b/dist-tools/webpack.config.rn-core.js index 6f0fa5a122..8184257583 100644 --- a/dist-tools/webpack.config.rn-core.js +++ b/dist-tools/webpack.config.rn-core.js @@ -29,4 +29,4 @@ module.exports = { } ] } -} \ No newline at end of file +}; diff --git a/dist-tools/webpack.config.rn-dep.js b/dist-tools/webpack.config.rn-dep.js index 90c05dbd2e..ed6057d929 100644 --- a/dist-tools/webpack.config.rn-dep.js +++ b/dist-tools/webpack.config.rn-dep.js @@ -28,4 +28,4 @@ module.exports = { } ] } -} \ No newline at end of file +}; diff --git a/dist-tools/webpack.config.rn.js b/dist-tools/webpack.config.rn.js index be54df174e..605ec8062d 100644 --- a/dist-tools/webpack.config.rn.js +++ b/dist-tools/webpack.config.rn.js @@ -31,4 +31,4 @@ module.exports = { } ] } -} \ No newline at end of file +}; diff --git a/lib/browser.js b/lib/browser.js index 9915093ead..dc0d2ef0be 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -16,4 +16,4 @@ if (typeof self !== 'undefined') self.AWS = AWS; * DO NOT REMOVE * browser builder will strip out this line if services are supplied on the command line. */ -require('../clients/browser_default'); \ No newline at end of file +require('../clients/browser_default'); diff --git a/lib/browserCryptoLib.js b/lib/browserCryptoLib.js index 5120d0a022..d5da313918 100644 --- a/lib/browserCryptoLib.js +++ b/lib/browserCryptoLib.js @@ -34,4 +34,4 @@ module.exports = exports = { createSign: function() { throw new Error('createSign is not implemented in the browser'); } - } + }; diff --git a/lib/browserHashUtils.js b/lib/browserHashUtils.js index 4f04f88efd..e5c615f285 100644 --- a/lib/browserHashUtils.js +++ b/lib/browserHashUtils.js @@ -62,4 +62,4 @@ function convertToBuffer(data) { module.exports = exports = { isEmptyData: isEmptyData, convertToBuffer: convertToBuffer, -} +}; diff --git a/lib/browserHmac.js b/lib/browserHmac.js index 8ff088b922..0a593104b6 100644 --- a/lib/browserHmac.js +++ b/lib/browserHmac.js @@ -50,7 +50,7 @@ Hmac.prototype.digest = function (encoding) { } return this.outer.digest(encoding); -} +}; function bufferFromSecret(hashCtor, secret) { var input = hashUtils.convertToBuffer(secret); diff --git a/lib/browserSha1.js b/lib/browserSha1.js index d9bf54a17a..cb2e36e57c 100644 --- a/lib/browserSha1.js +++ b/lib/browserSha1.js @@ -163,4 +163,4 @@ Sha1.prototype.processBlock = function processBlock() { for (i = 0; i < 16; i++) { this.block[i] = 0; } -} +}; diff --git a/lib/cloudfront/signer.js b/lib/cloudfront/signer.js index 69544d5697..5aa43475f4 100644 --- a/lib/cloudfront/signer.js +++ b/lib/cloudfront/signer.js @@ -18,7 +18,7 @@ var queryEncode = function (string) { var signPolicy = function (policy, privateKey) { var sign = crypto.createSign('RSA-SHA1'); sign.write(policy); - return queryEncode(sign.sign(privateKey, 'base64')) + return queryEncode(sign.sign(privateKey, 'base64')); }; var signWithCannedPolicy = function (url, expires, keyPairId, privateKey) { @@ -45,7 +45,7 @@ var signWithCustomPolicy = function (policy, keyPairId, privateKey) { Policy: queryEncode(base64Encode(policy)), 'Key-Pair-Id': keyPairId, Signature: signPolicy(policy, privateKey) - } + }; }; var determineScheme = function (url) { diff --git a/lib/credentials/chainable_temporary_credentials.js b/lib/credentials/chainable_temporary_credentials.js index 7a8283478a..7dc6e9daea 100644 --- a/lib/credentials/chainable_temporary_credentials.js +++ b/lib/credentials/chainable_temporary_credentials.js @@ -105,7 +105,7 @@ AWS.ChainableTemporaryCredentials = AWS.util.inherit(AWS.Credentials, { this.expired = true; this.tokenCodeFn = null; - var params = AWS.util.copy(options.params) || {} + var params = AWS.util.copy(options.params) || {}; if (params.RoleArn) { params.RoleSessionName = params.RoleSessionName || 'temporary-credentials'; } diff --git a/lib/discover_endpoint.js b/lib/discover_endpoint.js index acf592b9a4..728390a785 100644 --- a/lib/discover_endpoint.js +++ b/lib/discover_endpoint.js @@ -20,10 +20,10 @@ function getCacheKey(request) { identifiers.region = service.config.region; } if (api.serviceId) { - identifiers.serviceId = api.serviceId + identifiers.serviceId = api.serviceId; } if (service.config.credentials.accessKeyId) { - identifiers.accessKeyId = service.config.credentials.accessKeyId + identifiers.accessKeyId = service.config.credentials.accessKeyId; } return identifiers; } @@ -356,4 +356,4 @@ module.exports = { marshallCustomIdentifiers: marshallCustomIdentifiers, getCacheKey: getCacheKey, invalidateCachedEndpoint: invalidateCachedEndpoints, -} \ No newline at end of file +}; diff --git a/lib/dynamodb/numberValue.js b/lib/dynamodb/numberValue.js index 54bca89991..356da2c63d 100644 --- a/lib/dynamodb/numberValue.js +++ b/lib/dynamodb/numberValue.js @@ -40,4 +40,4 @@ var DynamoDBNumberValue = util.inherit({ /** * @api private */ -module.exports = DynamoDBNumberValue; \ No newline at end of file +module.exports = DynamoDBNumberValue; diff --git a/lib/empty.js b/lib/empty.js index d720bf6b92..07f55dca53 100644 --- a/lib/empty.js +++ b/lib/empty.js @@ -3,4 +3,4 @@ /** * @api private */ -module.exports = {}; \ No newline at end of file +module.exports = {}; diff --git a/lib/event-stream/alloc-buffer.js b/lib/event-stream/alloc-buffer.js index 3501a0df3e..7f918a6e24 100644 --- a/lib/event-stream/alloc-buffer.js +++ b/lib/event-stream/alloc-buffer.js @@ -18,4 +18,4 @@ function allocBuffer(size) { */ module.exports = { allocBuffer: allocBuffer -}; \ No newline at end of file +}; diff --git a/lib/event-stream/buffered-create-event-stream.js b/lib/event-stream/buffered-create-event-stream.js index c60d525c65..b96ca38afe 100644 --- a/lib/event-stream/buffered-create-event-stream.js +++ b/lib/event-stream/buffered-create-event-stream.js @@ -18,4 +18,4 @@ function createEventStream(body, parser, model) { */ module.exports = { createEventStream: createEventStream -}; \ No newline at end of file +}; diff --git a/lib/event-stream/build-message.js b/lib/event-stream/build-message.js index 87e5059ce5..ea2bb7d5e5 100644 --- a/lib/event-stream/build-message.js +++ b/lib/event-stream/build-message.js @@ -171,4 +171,4 @@ var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12 */ module.exports = { buildMessage: buildMessage -}; \ No newline at end of file +}; diff --git a/lib/event-stream/event-message-chunker-stream.js b/lib/event-stream/event-message-chunker-stream.js index 52353db5fa..0b0a0b1ccb 100644 --- a/lib/event-stream/event-message-chunker-stream.js +++ b/lib/event-stream/event-message-chunker-stream.js @@ -96,7 +96,7 @@ EventMessageChunkerStream.prototype._flush = function(callback) { } else { callback(); } -} +}; /** * @param {number} size Size of the message to be allocated. @@ -117,4 +117,4 @@ EventMessageChunkerStream.prototype.allocateMessage = function(size) { */ module.exports = { EventMessageChunkerStream: EventMessageChunkerStream -}; \ No newline at end of file +}; diff --git a/lib/event-stream/event-message-chunker.js b/lib/event-stream/event-message-chunker.js index 112879a8b0..7a71d8f9d8 100644 --- a/lib/event-stream/event-message-chunker.js +++ b/lib/event-stream/event-message-chunker.js @@ -27,4 +27,4 @@ function eventMessageChunker(buffer) { */ module.exports = { eventMessageChunker: eventMessageChunker -}; \ No newline at end of file +}; diff --git a/lib/event-stream/event-message-unmarshaller-stream.js b/lib/event-stream/event-message-unmarshaller-stream.js index 9894891a4d..a52fbaf678 100644 --- a/lib/event-stream/event-message-unmarshaller-stream.js +++ b/lib/event-stream/event-message-unmarshaller-stream.js @@ -36,4 +36,4 @@ EventUnmarshallerStream.prototype._transform = function(chunk, encoding, callbac */ module.exports = { EventUnmarshallerStream: EventUnmarshallerStream -}; \ No newline at end of file +}; diff --git a/lib/event-stream/int64.js b/lib/event-stream/int64.js index 8a6a88f08a..6ccce9e875 100644 --- a/lib/event-stream/int64.js +++ b/lib/event-stream/int64.js @@ -33,7 +33,7 @@ Int64.fromNumber = function(number) { ); } - var bytes = new Uint8Array(8) + var bytes = new Uint8Array(8); for ( var i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; @@ -90,4 +90,4 @@ function negate(bytes) { */ module.exports = { Int64: Int64 -}; \ No newline at end of file +}; diff --git a/lib/event-stream/parse-event.js b/lib/event-stream/parse-event.js index b3251ac746..44ebb6b94f 100644 --- a/lib/event-stream/parse-event.js +++ b/lib/event-stream/parse-event.js @@ -70,4 +70,4 @@ function parseError(message) { */ module.exports = { parseEvent: parseEvent -}; \ No newline at end of file +}; diff --git a/lib/event-stream/parse-message.js b/lib/event-stream/parse-message.js index 83b7ddf2c3..013493a2c0 100644 --- a/lib/event-stream/parse-message.js +++ b/lib/event-stream/parse-message.js @@ -125,4 +125,4 @@ function parseMessage(message) { */ module.exports = { parseMessage: parseMessage -}; \ No newline at end of file +}; diff --git a/lib/event-stream/split-message.js b/lib/event-stream/split-message.js index 2e8678cfd1..a7b4cdec0e 100644 --- a/lib/event-stream/split-message.js +++ b/lib/event-stream/split-message.js @@ -67,4 +67,4 @@ function splitMessage(message) { */ module.exports = { splitMessage: splitMessage -}; \ No newline at end of file +}; diff --git a/lib/event-stream/streaming-create-event-stream.js b/lib/event-stream/streaming-create-event-stream.js index 9361df5baa..26eadd3ee5 100644 --- a/lib/event-stream/streaming-create-event-stream.js +++ b/lib/event-stream/streaming-create-event-stream.js @@ -36,4 +36,4 @@ function createEventStream(stream, parser, model) { */ module.exports = { createEventStream: createEventStream -}; \ No newline at end of file +}; diff --git a/lib/event-stream/to-buffer.js b/lib/event-stream/to-buffer.js index 8f058e6d71..9bf87bd58d 100644 --- a/lib/event-stream/to-buffer.js +++ b/lib/event-stream/to-buffer.js @@ -15,4 +15,4 @@ function toBuffer(data, encoding) { */ module.exports = { toBuffer: toBuffer -}; \ No newline at end of file +}; diff --git a/lib/event_listeners.js b/lib/event_listeners.js index f1c8b3eaf1..92a4692b3c 100644 --- a/lib/event_listeners.js +++ b/lib/event_listeners.js @@ -512,23 +512,23 @@ AWS.EventListeners = { } else { struct[subShapeName] = subShape; } - }) - return struct + }); + return struct; case 'list': var list = []; AWS.util.arrayEach(shape, function(subShape, index) { list.push(filterSensitiveLog(inputShape.member, subShape)); - }) + }); return list; case 'map': var map = {}; AWS.util.each(shape, function(key, value) { map[key] = filterSensitiveLog(inputShape.value, value); - }) + }); return map; default: if (inputShape.isSensitive) { - return '***SensitiveInformation***' + return '***SensitiveInformation***'; } else { return shape; } diff --git a/lib/http.js b/lib/http.js index f6b28aa732..f49a53caa8 100644 --- a/lib/http.js +++ b/lib/http.js @@ -160,7 +160,7 @@ AWS.HttpRequest = inherit({ updateEndpoint: function updateEndpoint(endpointStr) { var newEndpoint = new AWS.Endpoint(endpointStr); this.endpoint = newEndpoint; - this.path = newEndpoint.path || '/' + this.path = newEndpoint.path || '/'; } }); diff --git a/lib/param_validator.js b/lib/param_validator.js index 841edfa40d..8c9530cdfa 100644 --- a/lib/param_validator.js +++ b/lib/param_validator.js @@ -113,7 +113,7 @@ AWS.ParamValidator = AWS.util.inherit({ if (!Object.prototype.hasOwnProperty.call(params, param)) continue; // Validate any map key trait constraints this.validateMember(shape.key, param, - context + '[key=\'' + param + '\']') + context + '[key=\'' + param + '\']'); this.validateMember(shape.value, params[param], context + '[\'' + param + '\']'); mapCount++; diff --git a/lib/protocol/helpers.js b/lib/protocol/helpers.js index bf993eefa6..cdd00a66a6 100644 --- a/lib/protocol/helpers.js +++ b/lib/protocol/helpers.js @@ -19,7 +19,7 @@ function populateHostPrefix(request) { prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix); validateHostname(request.httpRequest.endpoint.hostname); } - return request + return request; } /** @@ -67,7 +67,7 @@ function prependEndpointPrefix(endpoint, prefix) { * @api private */ function validateHostname(hostname) { - var labels = hostname.split('.') + var labels = hostname.split('.'); //Reference: https://tools.ietf.org/html/rfc1123#section-2 var hostPattern = /^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/; util.arrayEach(labels, function(label) { @@ -75,7 +75,7 @@ function validateHostname(hostname) { throw util.error(new Error(), { code: 'ValidationError', message: 'Hostname label length should be between 1 to 63 characters, inclusive.' - }) + }); } if (!hostPattern.test(label)) { throw AWS.util.error(new Error(), @@ -86,4 +86,4 @@ function validateHostname(hostname) { module.exports = { populateHostPrefix: populateHostPrefix -} \ No newline at end of file +}; diff --git a/lib/publisher/index.js b/lib/publisher/index.js index 8794d0a2e3..68b59e558c 100644 --- a/lib/publisher/index.js +++ b/lib/publisher/index.js @@ -57,7 +57,7 @@ Publisher.prototype.trimFields = function(event) { } } return event; -} +}; /** * Handles ApiCall and ApiCallAttempt events. @@ -77,7 +77,7 @@ Publisher.prototype.eventHandler = function(event) { } this.publishDatagram(message); -} +}; /** * Publishes message to an agent. @@ -92,10 +92,10 @@ Publisher.prototype.publishDatagram = function(message) { this.client.send(message, 0, message.length, this.port, this.address, function(err, bytes) { if (--self.messagesInFlight <= 0) { // destroy existing client so the event loop isn't kept open - self.destroyClient() + self.destroyClient(); } }); -} +}; /** * Returns an existing udp socket, or creates one if it doesn't already exist. @@ -106,7 +106,7 @@ Publisher.prototype.getClient = function() { this.client = dgram.createSocket('udp4'); } return this.client; -} +}; /** * Destroys the udp socket. @@ -117,7 +117,7 @@ Publisher.prototype.destroyClient = function() { this.client.close(); this.client = void 0; } -} +}; module.exports = { Publisher: Publisher diff --git a/lib/publisher/string-to-buffer.js b/lib/publisher/string-to-buffer.js index 8a5ac7824c..d757d50bf0 100644 --- a/lib/publisher/string-to-buffer.js +++ b/lib/publisher/string-to-buffer.js @@ -10,4 +10,4 @@ function stringToBuffer(data) { module.exports = { stringToBuffer: stringToBuffer -}; \ No newline at end of file +}; diff --git a/lib/rds/signer.js b/lib/rds/signer.js index d9abbe7d50..9665479742 100644 --- a/lib/rds/signer.js +++ b/lib/rds/signer.js @@ -214,4 +214,4 @@ AWS.RDS.Signer = AWS.util.inherit({ } return true; } -}); \ No newline at end of file +}); diff --git a/lib/react-native/add-content-type.js b/lib/react-native/add-content-type.js index 77c6608dba..a3de4923cb 100644 --- a/lib/react-native/add-content-type.js +++ b/lib/react-native/add-content-type.js @@ -15,4 +15,4 @@ function addContentType(req) { */ module.exports = { addContentType: addContentType -}; \ No newline at end of file +}; diff --git a/lib/realclock/browserClock.js b/lib/realclock/browserClock.js index d93bfa07a9..131b3d6411 100644 --- a/lib/realclock/browserClock.js +++ b/lib/realclock/browserClock.js @@ -6,4 +6,4 @@ module.exports = { } return Date.now(); } -} +}; diff --git a/lib/realclock/nodeClock.js b/lib/realclock/nodeClock.js index 05f59dd7f8..4685a668ef 100644 --- a/lib/realclock/nodeClock.js +++ b/lib/realclock/nodeClock.js @@ -4,4 +4,4 @@ module.exports = { var second = process.hrtime(); return second[0] * 1000 + (second[1] / 1000000); } -} +}; diff --git a/lib/sequential_executor.js b/lib/sequential_executor.js index e40bc59f5a..73d967c7c5 100644 --- a/lib/sequential_executor.js +++ b/lib/sequential_executor.js @@ -232,4 +232,4 @@ AWS.SequentialExecutor.prototype.addListener = AWS.SequentialExecutor.prototype. /** * @api private */ -module.exports = AWS.SequentialExecutor; \ No newline at end of file +module.exports = AWS.SequentialExecutor; diff --git a/lib/service.js b/lib/service.js index 2463910ad6..28dd34f448 100644 --- a/lib/service.js +++ b/lib/service.js @@ -299,7 +299,7 @@ AWS.Service = inherit({ Region: request.httpRequest.region, MaxRetriesExceeded: 0, UserAgent: request.httpRequest.getUserAgent(), - } + }; var response = request.response; if (response.httpResponse.statusCode) { monitoringEvent.FinalHttpStatusCode = response.httpResponse.statusCode; @@ -315,7 +315,7 @@ AWS.Service = inherit({ if (error.message) monitoringEvent.FinalSdkExceptionMessage = error.message; } } - return monitoringEvent + return monitoringEvent; }, /** @@ -357,7 +357,7 @@ AWS.Service = inherit({ if (response.httpResponse.headers['x-amz-id-2']) { monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2']; } - return monitoringEvent + return monitoringEvent; }, /** @@ -403,10 +403,10 @@ AWS.Service = inherit({ attemptTimestamp = Date.now(); region = request.httpRequest.region; attemptCount++; - }, addToHead) + }, addToHead); request.on('validateResponse', function() { attemptLatency = Math.round(AWS.util.realClock.now() - attemptStartRealTime); - }) + }); request.addNamedListener('API_CALL_ATTEMPT', 'success', function API_CALL_ATTEMPT() { var apiAttemptEvent = self.apiAttemptEvent(request); apiAttemptEvent.Timestamp = attemptTimestamp; @@ -437,10 +437,10 @@ AWS.Service = inherit({ typeof response.maxRetries === 'number' && (response.retryCount >= response.maxRetries) ) { - apiCallEvent.MaxRetriesExceeded = 1 + apiCallEvent.MaxRetriesExceeded = 1; } self.emit('apiCall', [apiCallEvent]); - }) + }); }, /** diff --git a/lib/services/cloudsearchdomain.js b/lib/services/cloudsearchdomain.js index e9c9431361..65f8eabbc1 100644 --- a/lib/services/cloudsearchdomain.js +++ b/lib/services/cloudsearchdomain.js @@ -98,14 +98,14 @@ AWS.util.update(AWS.CloudSearchDomain.prototype, { * @api private */ convertGetToPost: function(request) { - var httpRequest = request.httpRequest + var httpRequest = request.httpRequest; // convert queries to POST to avoid length restrictions - var path = httpRequest.path.split('?') - httpRequest.method = 'POST' - httpRequest.path = path[0] - httpRequest.body = path[1] - httpRequest.headers['Content-Length'] = httpRequest.body.length - httpRequest.headers['Content-Type'] = 'application/x-www-form-urlencoded' + var path = httpRequest.path.split('?'); + httpRequest.method = 'POST'; + httpRequest.path = path[0]; + httpRequest.body = path[1]; + httpRequest.headers['Content-Length'] = httpRequest.body.length; + httpRequest.headers['Content-Type'] = 'application/x-www-form-urlencoded'; }, /** diff --git a/lib/services/polly.js b/lib/services/polly.js index 1bc97f7c6a..03d1b57bd5 100644 --- a/lib/services/polly.js +++ b/lib/services/polly.js @@ -1 +1 @@ -require('../polly/presigner'); \ No newline at end of file +require('../polly/presigner'); diff --git a/lib/services/rds.js b/lib/services/rds.js index 02c464ecf3..9d785746ee 100644 --- a/lib/services/rds.js +++ b/lib/services/rds.js @@ -58,4 +58,4 @@ require('../rds/signer'); } }); } - }); \ No newline at end of file + }); diff --git a/lib/shared-ini/index.js b/lib/shared-ini/index.js index 84bf0a68be..98972915f0 100644 --- a/lib/shared-ini/index.js +++ b/lib/shared-ini/index.js @@ -3,4 +3,4 @@ var IniLoader = require('./ini-loader').IniLoader; * Singleton object to load specified config/credentials files. * It will cache all the files ever loaded; */ -module.exports.iniLoader = new IniLoader(); \ No newline at end of file +module.exports.iniLoader = new IniLoader(); diff --git a/lib/shared-ini/ini-loader.js b/lib/shared-ini/ini-loader.js index 6000cc0105..61bc30cb0c 100644 --- a/lib/shared-ini/ini-loader.js +++ b/lib/shared-ini/ini-loader.js @@ -11,7 +11,7 @@ function parseFile(filename, isConfig) { Object.defineProperty(tmpContent, profileName, { value: profileContent, enumerable: true - }) + }); }); return tmpContent; } @@ -103,4 +103,4 @@ var IniLoader = AWS.IniLoader; module.exports = { IniLoader: IniLoader, parseFile: parseFile, -} \ No newline at end of file +}; diff --git a/lib/xml/browser_parser.js b/lib/xml/browser_parser.js index bb2c1c8175..32740d0f34 100644 --- a/lib/xml/browser_parser.js +++ b/lib/xml/browser_parser.js @@ -105,7 +105,7 @@ function parseStructure(xml, shape) { } } else { var xmlChild = memberShape.flattened ? xml : - getElementByTagName(xml, memberShape.name) + getElementByTagName(xml, memberShape.name); if (xmlChild) { data[memberName] = parseXml(xmlChild, memberShape); } else if (!memberShape.flattened && memberShape.type === 'list') { diff --git a/lib/xml/builder.js b/lib/xml/builder.js index 1491fa231d..e1a3871372 100644 --- a/lib/xml/builder.js +++ b/lib/xml/builder.js @@ -52,8 +52,8 @@ function serializeMap(xml, map, shape) { var entryKey = new XmlNode(xmlKey); var entryValue = new XmlNode(xmlValue); - entry.addChildNode(entryKey) - entry.addChildNode(entryValue) + entry.addChildNode(entryKey); + entry.addChildNode(entryValue); serialize(entryKey, key, shape.key); serialize(entryValue, value, shape.value); diff --git a/lib/xml/escape-attribute.js b/lib/xml/escape-attribute.js index 082951bef7..eabbedc6c4 100644 --- a/lib/xml/escape-attribute.js +++ b/lib/xml/escape-attribute.js @@ -10,4 +10,4 @@ function escapeAttribute(value) { */ module.exports = { escapeAttribute: escapeAttribute -}; \ No newline at end of file +}; diff --git a/lib/xml/escape-element.js b/lib/xml/escape-element.js index 727ced558d..0033161869 100644 --- a/lib/xml/escape-element.js +++ b/lib/xml/escape-element.js @@ -10,4 +10,4 @@ function escapeElement(value) { */ module.exports = { escapeElement: escapeElement -}; \ No newline at end of file +}; diff --git a/lib/xml/xml-node.js b/lib/xml/xml-node.js index 36c8e51e39..ed5afe4376 100644 --- a/lib/xml/xml-node.js +++ b/lib/xml/xml-node.js @@ -42,4 +42,4 @@ XmlNode.prototype.toString = function () { */ module.exports = { XmlNode: XmlNode -}; \ No newline at end of file +}; diff --git a/lib/xml/xml-text.js b/lib/xml/xml-text.js index aa1c3b9d9a..8424443e46 100644 --- a/lib/xml/xml-text.js +++ b/lib/xml/xml-text.js @@ -17,4 +17,4 @@ XmlText.prototype.toString = function () { */ module.exports = { XmlText: XmlText -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index 39eb785674..6bfc2da2f9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "coffee-script": "1.6.3", "coffeeify": "*", "cucumber": "0.5.x", - "eslint": "1.x", + "eslint": "^5.8.0", "hash-test-vectors": "^1.3.2", "insert-module-globals": "^7.0.0", "istanbul": "*", @@ -28,8 +28,8 @@ "jasmine-core": "^2.5.2", "json-loader": "^0.5.4", "karma": "^2.0.0", - "karma-jasmine": "^1.1.0", "karma-chrome-launcher": "2.2.0", + "karma-jasmine": "^1.1.0", "mocha": "^3.0.0", "repl.history": "*", "semver": "*", @@ -126,7 +126,7 @@ "browsertest": "rake browser:test && karma start", "buildertest": "mocha --compilers coffee:coffee-script -s 1000 -t 10000 dist-tools/test", "integration": "cucumber.js", - "lint": "eslint lib dist-tools/*.js", + "lint": "eslint lib test dist-tools/*.js", "console": "./scripts/console", "testfiles": "istanbul `[ $COVERAGE ] && echo 'cover _mocha' || echo 'test mocha'`", "tstest": "npm -s run-script build-typings && tsc -p ./ts", @@ -143,4 +143,4 @@ "helper-test": "mocha scripts/lib/test-helper.spec.js", "csm-functional-test": "mocha test/publisher/functional_test" } -} \ No newline at end of file +} diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 0000000000..4063e3bde8 --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "../.eslintrc", + "parserOptions": { + "ecmaVersion": 8 + } +} diff --git a/test/browser.spec.js b/test/browser.spec.js index 3ee62e4036..5246ae165f 100644 --- a/test/browser.spec.js +++ b/test/browser.spec.js @@ -223,7 +223,7 @@ }); return it('lower cases HTTP headers', function() { var client, headers, rawHeaders; - rawHeaders = "x-amzn-Foo: foo\nx-amzn-Bar: bar"; + rawHeaders = 'x-amzn-Foo: foo\nx-amzn-Bar: bar'; client = new AWS.XHRClient(); headers = client.parseHeaders(rawHeaders); expect(headers['x-amzn-foo']).to.equal('foo'); @@ -1194,7 +1194,7 @@ } }, function(err, data) { noError(err); - var records = [] + var records = []; for (var i = 0; i < data.Payload.length; i++) { var event = data.Payload[i]; if (event.Records) { @@ -1207,7 +1207,7 @@ ); done(); }); - }) + }); }); describe('upload()', function() { diff --git a/test/browserHashes/hashes.spec.js b/test/browserHashes/hashes.spec.js index 0e31c87bc8..96480a0c14 100644 --- a/test/browserHashes/hashes.spec.js +++ b/test/browserHashes/hashes.spec.js @@ -22,7 +22,7 @@ describe('Browser hash implementations', function() { var hash = new ctor(); hash.update(input); expect(hash.digest('hex')).to.equal(expected); - } + }; })( new Buffer(hashVectors[i].input, 'base64'), hashVectors[i][hashType], @@ -44,7 +44,7 @@ describe('Browser hash implementations', function() { digest = digest.slice(0, truncate); } expect(digest.toString('hex')).to.equal(expected); - } + }; })( new Buffer(hmacVectors[i].key, 'hex'), new Buffer(hmacVectors[i].data, 'hex'), diff --git a/test/clients.spec.js b/test/clients.spec.js index 4376b2d9e5..edb4a53a74 100644 --- a/test/clients.spec.js +++ b/test/clients.spec.js @@ -24,7 +24,7 @@ for (var serviceAbbreviation in metadata) { })(clientName, version) ); } - } + }; })(clientName, serviceAbbreviation) ); } diff --git a/test/config.spec.js b/test/config.spec.js index 084de261f3..6ebbcd8704 100644 --- a/test/config.spec.js +++ b/test/config.spec.js @@ -421,7 +421,7 @@ describe('AWS.Config', function() { } config.getCredentials(spy); expect(spy.calls.length).not.to.equal(0); - expect(spy.calls[0]["arguments"][0]).not.to.exist; + expect(spy.calls[0]['arguments'][0]).not.to.exist; if (key) { expect(config.credentials.accessKeyId).to.equal(key); } @@ -435,9 +435,9 @@ describe('AWS.Config', function() { } config.getCredentials(spy); expect(spy.calls.length).not.to.equal(0); - expect(spy.calls[0]["arguments"][0].code).to.equal('CredentialsError'); - expect(spy.calls[0]["arguments"][0].name).to.equal('CredentialsError'); - expect(spy.calls[0]["arguments"][0].message).to.equal(message); + expect(spy.calls[0]['arguments'][0].code).to.equal('CredentialsError'); + expect(spy.calls[0]['arguments'][0].name).to.equal('CredentialsError'); + expect(spy.calls[0]['arguments'][0].message).to.equal(message); }; it('should check credentials for static object first', function() { @@ -539,8 +539,8 @@ describe('AWS.config', function() { var utilSpy = helpers.spyOn(AWS.util, 'addPromises'); AWS.config.setPromisesDependency(function() {}); expect(utilSpy.calls.length).to.equal(1); - expect(Array.isArray(utilSpy.calls[0]["arguments"][0])).to.be["true"]; - expect(utilSpy.calls[0]["arguments"][0].length).to.equal(4); + expect(Array.isArray(utilSpy.calls[0]['arguments'][0])).to.be['true']; + expect(utilSpy.calls[0]['arguments'][0].length).to.equal(4); }); if (typeof Promise !== 'undefined') { @@ -548,10 +548,10 @@ describe('AWS.config', function() { var P = function() {}; var utilSpy = helpers.spyOn(AWS.util, 'addPromises'); AWS.config.setPromisesDependency(P); - expect(utilSpy.calls[0]["arguments"][1] === P).to.be["true"]; + expect(utilSpy.calls[0]['arguments'][1] === P).to.be['true']; AWS.config.setPromisesDependency(null); - expect(utilSpy.calls[1]["arguments"][1] === Promise).to.be["true"]; - expect(utilSpy.calls[1]["arguments"][1] === P).to.be["false"]; + expect(utilSpy.calls[1]['arguments'][1] === Promise).to.be['true']; + expect(utilSpy.calls[1]['arguments'][1] === P).to.be['false']; }); } }); diff --git a/test/credential_provider_chain.spec.js b/test/credential_provider_chain.spec.js index a9ccc62117..4869d03de1 100644 --- a/test/credential_provider_chain.spec.js +++ b/test/credential_provider_chain.spec.js @@ -123,8 +123,8 @@ get: function get(callback) { getCalls++; setImmediate(function () { - this.accessKeyId = 'abc' - this.secretAccessKey = 'xyz' + this.accessKeyId = 'abc'; + this.secretAccessKey = 'xyz'; callback(); }); } @@ -176,19 +176,19 @@ }); it('resolves when creds successfully retrieved from a provider in the chain', function() { forceError = false; - return chain.resolvePromise().then(thenFunction)["catch"](catchFunction).then(function() { - expect(err).to.be["null"]; - expect(creds).to.not.be["null"]; + return chain.resolvePromise().then(thenFunction)['catch'](catchFunction).then(function() { + expect(err).to.be['null']; + expect(creds).to.not.be['null']; expect(creds.accessKeyId).to.equal('akid'); return expect(creds.secretAccessKey).to.equal('secret'); }); }); return it('rejects when all providers in chain return an error', function() { forceError = true; - return chain.resolvePromise().then(thenFunction)["catch"](catchFunction).then(function() { - expect(err).to.not.be["null"]; + return chain.resolvePromise().then(thenFunction)['catch'](catchFunction).then(function() { + expect(err).to.not.be['null']; expect(err.code).to.equal('MockCredentialsProviderFailure'); - return expect(creds).to.be["null"]; + return expect(creds).to.be['null']; }); }); }); diff --git a/test/credentials.spec.js b/test/credentials.spec.js index d7a0f72c8d..2e2006f575 100644 --- a/test/credentials.spec.js +++ b/test/credentials.spec.js @@ -95,7 +95,7 @@ creds.get(spy); expect(refresh.calls.length).to.equal(0); expect(spy.calls.length).not.to.equal(0); - expect(spy.calls[0]["arguments"][0]).not.to.exist; + expect(spy.calls[0]['arguments'][0]).not.to.exist; return expect(creds.expired).to.equal(false); }); return it('calls refresh only if needsRefresh', function() { @@ -107,7 +107,7 @@ creds.get(spy); expect(refresh.calls.length).not.to.equal(0); expect(spy.calls.length).not.to.equal(0); - expect(spy.calls[0]["arguments"][0]).not.to.exist; + expect(spy.calls[0]['arguments'][0]).not.to.exist; return expect(creds.expired).to.equal(false); }); }); @@ -232,7 +232,7 @@ }); return expect(function() { return new AWS.FileSystemCredentials('foo').refresh(); - }).to["throw"]('Credentials not set in foo'); + }).to['throw']('Credentials not set in foo'); }); }); }); @@ -263,7 +263,7 @@ new AWS.SharedIniFileCredentials(); expect(os.homedir.calls.length).to.equal(1); expect(AWS.util.readFileSync.calls.length).to.equal(1); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/[\/\\]foo[\/\\]bar[\/\\]baz[\/\\].aws[\/\\]credentials/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/[\/\\]foo[\/\\]bar[\/\\]baz[\/\\].aws[\/\\]credentials/); }); it('should prefer $HOME to os.homedir', function() { process.env.HOME = '/home/user'; @@ -291,7 +291,7 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); expect(AWS.util.readFileSync.calls.length).to.equal(1); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/d:[\/\\]homepath[\/\\].aws[\/\\]credentials/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/d:[\/\\]homepath[\/\\].aws[\/\\]credentials/); }); it('uses default HOMEDRIVE of C:/', function() { var creds; @@ -299,7 +299,7 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); expect(AWS.util.readFileSync.calls.length).to.equal(1); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/C:[\/\\]homepath[\/\\].aws[\/\\]credentials/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/C:[\/\\]homepath[\/\\].aws[\/\\]credentials/); }); it('uses USERPROFILE if HOME is not set', function() { var creds; @@ -307,7 +307,7 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); expect(AWS.util.readFileSync.calls.length).to.equal(1); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/[\/\\]userprofile[\/\\].aws[\/\\]credentials/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/[\/\\]userprofile[\/\\].aws[\/\\]credentials/); }); return it('can override filename as a constructor argument', function() { var creds; @@ -316,7 +316,7 @@ }); creds.get(); expect(AWS.util.readFileSync.calls.length).to.equal(1); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.equal('/etc/creds'); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.equal('/etc/creds'); }); }); describe('loading', function() { @@ -333,7 +333,7 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); validateCredentials(creds); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]credentials/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]credentials/); }); it('loads credentials from path defined in AWS_SHARED_CREDENTIALS_FILE if AWS_SDK_LOAD_CONFIG is set', function() { var creds, mock; @@ -344,8 +344,8 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); validateCredentials(creds); - expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]config/); - return expect(AWS.util.readFileSync.calls[1]["arguments"][0]).to.equal(process.env.AWS_SHARED_CREDENTIALS_FILE); + expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]config/); + return expect(AWS.util.readFileSync.calls[1]['arguments'][0]).to.equal(process.env.AWS_SHARED_CREDENTIALS_FILE); }); it('loads credentials from ~/.aws/config if AWS_SDK_LOAD_CONFIG is set', function() { var creds, mock; @@ -355,7 +355,7 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); validateCredentials(creds); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]config/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]config/); }); it('prefers credentials from ~/.aws/credentials if AWS_SDK_LOAD_CONFIG is set', function() { var creds; @@ -397,7 +397,7 @@ creds = new AWS.SharedIniFileCredentials(); creds.get(); validateCredentials(creds); - return expect(AWS.util.readFileSync.calls[0]["arguments"][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]credentials/); + return expect(AWS.util.readFileSync.calls[0]['arguments'][0]).to.match(/[\/\\]home[\/\\]user[\/\\].aws[\/\\]credentials/); }); it('loads the default profile if AWS_PROFILE is empty', function() { var creds, mock; @@ -563,9 +563,9 @@ expect(err).to.be.null; expect(assumeRoleSpy.calls.length).to.equal(2); expect(creds.roleArn).to.equal('arn'); - firstAssumeRoleArg = assumeRoleSpy.calls[0]["arguments"][0]; + firstAssumeRoleArg = assumeRoleSpy.calls[0]['arguments'][0]; expect(firstAssumeRoleArg.RoleArn).to.equal('arn_foo_first'); - secondAssumeRoleArg = assumeRoleSpy.calls[1]["arguments"][0]; + secondAssumeRoleArg = assumeRoleSpy.calls[1]['arguments'][0]; expect(secondAssumeRoleArg.RoleArn).to.equal('arn'); expect(creds.accessKeyId).to.equal('KEY'); expect(creds.secretAccessKey).to.equal('SECRET'); @@ -592,7 +592,7 @@ return creds.refresh(function(err) { var sourceCreds; expect(credsCtorSpy.calls.length).to.equal(1); - parentCredsArg = credsCtorSpy.calls[0]["arguments"][0]; + parentCredsArg = credsCtorSpy.calls[0]['arguments'][0]; expect(parentCredsArg.profile).to.equal('foo'); expect(creds.accessKeyId).to.equal('KEY'); expect(creds.secretAccessKey).to.equal('SECRET'); @@ -619,7 +619,7 @@ return creds.refresh(function(err) { var sourceCreds; expect(credsCtorSpy.calls.length).to.equal(1); - parentCredsArg = credsCtorSpy.calls[0]["arguments"][0]; + parentCredsArg = credsCtorSpy.calls[0]['arguments'][0]; expect(parentCredsArg.profile).to.equal('foo'); expect(creds.accessKeyId).to.equal('KEY'); expect(creds.secretAccessKey).to.equal('SECRET'); @@ -640,7 +640,7 @@ expect(creds.roleArn).to.equal('arn'); return creds.refresh(function(err) { expect(assumeRoleSpy.calls.length).to.equal(1); - firstAssumeRoleArg = assumeRoleSpy.calls[0]["arguments"][0]; + firstAssumeRoleArg = assumeRoleSpy.calls[0]['arguments'][0]; expect(firstAssumeRoleArg.RoleArn).to.equal('arn'); return done(); }); @@ -671,9 +671,9 @@ expect(err).to.be.null; expect(creds.roleArn).to.equal('arn'); expect(assumeRoleSpy.calls.length).to.equal(2); - firstAssumeRoleArg = assumeRoleSpy.calls[0]["arguments"][0]; + firstAssumeRoleArg = assumeRoleSpy.calls[0]['arguments'][0]; expect(firstAssumeRoleArg.RoleArn).to.equal('arn_foo_first'); - secondAssumeRoleArg = assumeRoleSpy.calls[1]["arguments"][0]; + secondAssumeRoleArg = assumeRoleSpy.calls[1]['arguments'][0]; expect(secondAssumeRoleArg.RoleArn).to.equal('arn'); done(); } @@ -843,13 +843,13 @@ }); }); it('fails if the loaded credentials are expired', function (done) { - mockMetadataService(new Date(Date.now() - 1)) + mockMetadataService(new Date(Date.now() - 1)); creds.refresh(function (err) { expect(err).to.be.not.null; expect(err.message).to.equal('EC2 Instance Metadata Serivce provided expired credentials'); expect(err.code).to.equal('EC2MetadataCredentialsProviderFailure'); done(); - }) + }); }); }); }); @@ -1031,13 +1031,13 @@ }; formattedCreds = creds.formatCreds(invalidData); expect(formattedCreds.InvalidKey).to.be.undefined; - expect(formattedCreds.accessKeyId).to.be["KEY"]; + expect(formattedCreds.accessKeyId).to.be['KEY']; }); it('renames valid keys', function() { formattedCreds = creds.formatCreds(responseData); - expect(formattedCreds.accessKeyId).to.be["KEY"]; - expect(formattedCreds.secretAccessKey).to.be["SECRET"]; - expect(formattedCreds.sessionToken).to.be["TOKEN"]; + expect(formattedCreds.accessKeyId).to.be['KEY']; + expect(formattedCreds.secretAccessKey).to.be['SECRET']; + expect(formattedCreds.sessionToken).to.be['TOKEN']; }); it('restructures valid creds', function() { var validData; @@ -1050,9 +1050,9 @@ } }; formattedCreds = creds.formatCreds(validData); - expect(formattedCreds.accessKeyId).to.be["KEY"]; - expect(formattedCreds.secretAccessKey).to.be["SECRET"]; - expect(formattedCreds.sessionToken).to.be["TOKEN"]; + expect(formattedCreds.accessKeyId).to.be['KEY']; + expect(formattedCreds.secretAccessKey).to.be['SECRET']; + expect(formattedCreds.sessionToken).to.be['TOKEN']; expect(formattedCreds.expireTime).to.eql(new Date(0)); }); }); @@ -1065,11 +1065,11 @@ SecretAccessKey: 'SECRET', Token: 'TOKEN' }; - expect(creds.credsFormatIsValid(incompleteData)).to.be["false"]; + expect(creds.credsFormatIsValid(incompleteData)).to.be['false']; }); it('returns true when formatted data has all required properties', function() { - expect(creds.credsFormatIsValid(responseData)).to.be["false"]; - expect(creds.credsFormatIsValid(creds.formatCreds(responseData))).to.be["true"]; + expect(creds.credsFormatIsValid(responseData)).to.be['false']; + expect(creds.credsFormatIsValid(creds.formatCreds(responseData))).to.be['true']; }); }); @@ -1095,7 +1095,7 @@ expect(spy.calls.length).to.equal(1); expect(spy.calls[0].arguments[0]) .to.equal('http://169.254.170.2/path'); - expect(callbackErr).to.be["null"]; + expect(callbackErr).to.be['null']; expect(creds.accessKeyId).to.equal('KEY'); expect(creds.secretAccessKey).to.equal('SECRET'); expect(creds.sessionToken).to.equal('TOKEN'); @@ -1112,7 +1112,7 @@ expect(spy.calls.length).to.equal(1); expect(spy.calls[0].arguments[0]) .to.equal('http://localhost/get-credentials'); - expect(callbackErr).to.be["null"]; + expect(callbackErr).to.be['null']; expect(creds.accessKeyId).to.equal('KEY'); expect(creds.secretAccessKey).to.equal('SECRET'); expect(creds.sessionToken).to.equal('TOKEN'); @@ -1144,7 +1144,7 @@ }); }); creds.refresh(function(err) { - expect(err).to.not.be["null"]; + expect(err).to.not.be['null']; expect(err.code).to.equal('TimeoutError'); expect(spy.calls.length).to.equal(4); done(); @@ -1161,7 +1161,7 @@ helpers.mockHttpSuccessfulResponse(200, {}, JSON.stringify(responseData), cb); }); creds.refresh(function(err) { - expect(err).to.be["null"]; + expect(err).to.be['null']; done(); }); }); @@ -1348,11 +1348,11 @@ describe('AWS.ChainableTemporaryCredentials', function() { var mockSTS; function setupCredsAndSTSMock(options) { - options = options || {} + options = options || {}; if (!options.params) { options.params = { DurationSeconds: 1200 - } + }; } var creds = new AWS.ChainableTemporaryCredentials(options); mockSTS = function(expireTime, tokenCode) { @@ -1392,8 +1392,8 @@ }); it('should throw if params.SerialNumber given without tokenCodeFn', function() { expect(function () { - new AWS.ChainableTemporaryCredentials({params: {SerialNumber: '123'}}) - }).to.throw('tokenCodeFn must be a function when params.SerialNumber is given') + new AWS.ChainableTemporaryCredentials({params: {SerialNumber: '123'}}); + }).to.throw('tokenCodeFn must be a function when params.SerialNumber is given'); }); it('should ignore tokenCodeFn if params.SerialNumber not given', function() { var creds = new AWS.ChainableTemporaryCredentials({ @@ -1420,7 +1420,7 @@ expect(err).to.not.exist; expect(credentials).to.equal(masterCredentials); done(); - }) + }); }); it('uses global credential provider when AWS.config.credentials is null', function(done) { var masterCredentials = new AWS.Credentials('AKID', 'SECRET'); @@ -1431,7 +1431,7 @@ AWS.config.credentials = new AWS.ChainableTemporaryCredentials(); AWS.config.credentials.service.config.getCredentials(function (err, credentials) { expect(err).to.not.exist; - expect(credentials).to.equal(masterCredentials) + expect(credentials).to.equal(masterCredentials); done(); }); }); @@ -1579,7 +1579,7 @@ creds.refresh(function (err) { expect(tokenCodeFn.calls.length).to.equal(1); expect(err).to.be.instanceof(Error); - expect(err.message).to.equal('Error fetching MFA token: boom') + expect(err.message).to.equal('Error fetching MFA token: boom'); done(); }); }); @@ -2439,16 +2439,16 @@ it('resolves when get is successful', function() { return mockCred.getPromise().then(function() { expect(spy.calls.length).to.equal(1); - expect(err).to.be["null"]; + expect(err).to.be['null']; expect(mockCred.accessKeyId).to.equal('akid'); return expect(mockCred.secretAccessKey).to.equal('secret'); }); }); return it('rejects when get is unsuccessful', function() { mockCred.forceRefreshError = true; - return mockCred.getPromise()["catch"](catchFunction).then(function() { + return mockCred.getPromise()['catch'](catchFunction).then(function() { expect(spy.calls.length).to.equal(1); - expect(err).to.not.be["null"]; + expect(err).to.not.be['null']; expect(err.code).to.equal('MockCredentialsProviderFailure'); expect(err.message).to.equal('mock credentials refresh error'); expect(mockCred.accessKeyId).to.be.undefined; @@ -2461,15 +2461,15 @@ var refreshError; refreshError = false; return mockCred.refreshPromise().then(function() { - expect(err).to.be["null"]; + expect(err).to.be['null']; expect(mockCred.accessKeyId).to.equal('akid'); return expect(mockCred.secretAccessKey).to.equal('secret'); }); }); return it('rejects when refresh is unsuccessful', function() { mockCred.forceRefreshError = true; - return mockCred.refreshPromise()["catch"](catchFunction).then(function() { - expect(err).to.not.be["null"]; + return mockCred.refreshPromise()['catch'](catchFunction).then(function() { + expect(err).to.not.be['null']; expect(err.code).to.equal('MockCredentialsProviderFailure'); expect(err.message).to.equal('mock credentials refresh error'); expect(mockCred.accessKeyId).to.be.undefined; diff --git a/test/discover_endpoint.spec.js b/test/discover_endpoint.spec.js index 2bc7fad4e6..2dca035661 100644 --- a/test/discover_endpoint.spec.js +++ b/test/discover_endpoint.spec.js @@ -1,7 +1,7 @@ var helpers = require('./helpers'); var http = require('http'); -var url = require('url') -var AWS = helpers.AWS +var url = require('url'); +var AWS = helpers.AWS; var endpoint_discovery_module = require('../lib/discover_endpoint'); var iniLoader = AWS.util.iniLoader; var getCacheKey = endpoint_discovery_module.getCacheKey; @@ -117,7 +117,7 @@ var api = { } } } -} +}; describe('endpoint discovery', function() { afterEach(function() { @@ -137,9 +137,9 @@ describe('endpoint discovery', function() { region: 'fake-region-1', serviceId: 'MockService', accessKeyId: 'akid' - }) + }); }); - + it('generate correct keys with endpointdiscoveryid traits', function() { var spy = helpers.spyOn(AWS.endpointCache, 'get').andReturn([{ Address: 'https://fakeService.amaoznaws.com' @@ -162,7 +162,7 @@ describe('endpoint discovery', function() { })); }); }); - + describe('marshallCustomIdentifiers', function() { it('can marshall params according to endpointdiscoveryid trait', function() { var MockService = helpers.MockServiceFromApi(api); @@ -177,12 +177,12 @@ describe('endpoint discovery', function() { expect(ids).to.eql({RecordItem: 'record'}); }); }); - + describe('optionalDiscoverEndpoint', function() { - beforeEach(function(){ + beforeEach(function() { AWS.endpointCache.empty(); - }) - + }); + it('gets first corresponding endpoint from endpoint cache', function() { var spy = helpers.spyOn(AWS.endpointCache, 'get').andReturn([{ Address: 'https://fakeService.amazonaws.com:22/path' @@ -194,7 +194,7 @@ describe('endpoint discovery', function() { region: 'fake-region-1', apiConfig: new AWS.Model.Api(api) }); - helpers.mockHttpResponse(200, {}, '{}') + helpers.mockHttpResponse(200, {}, '{}'); var request = client.makeRequest('optionalEDOperation', {Query: 'query'}); request.send(); expect(spy.calls.length).to.eql(1); @@ -203,9 +203,9 @@ describe('endpoint discovery', function() { port: 22, protocol: 'https:', path: '/path' - }) + }); }); - + it('use regional endpoint of new endpoint cannot be discovered', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -213,9 +213,9 @@ describe('endpoint discovery', function() { apiConfig: new AWS.Model.Api(api) }); var request = client.makeRequest('optionalEDOperation', {Query: 'query'}); - expect(request.httpRequest.endpoint.hostname).to.eql('mockservice.fake-region-1.amazonaws.com') + expect(request.httpRequest.endpoint.hostname).to.eql('mockservice.fake-region-1.amazonaws.com'); }); - + it('put in endpoint cache is endpoint operation succeeds', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -254,7 +254,7 @@ describe('endpoint discovery', function() { expect(makeRequestSpy.calls[0].arguments[0]).to.eql('optionalEDOperation'); }); }); - + it('make one endpoint operation for same cache keys before endpoint operation response returning', function() { var spy = helpers.spyOn(AWS.HttpClient, 'getInstance').andCallThrough(); var client = new AWS.Service({ @@ -266,9 +266,9 @@ describe('endpoint discovery', function() { client.makeRequest('optionalEDOperation', {Query: 'query'}).send(); client.makeRequest('optionalEDOperation', {Query: 'query'}).send(); //should not make 4 calls which request endpoint once for every api call - expect(spy.calls.length).to.eql(3) + expect(spy.calls.length).to.eql(3); }); - + it('should put in an undefined cache record valid for 1 minute when failed', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -287,7 +287,7 @@ describe('endpoint discovery', function() { expect(spy.calls[1].arguments[1]).to.eql([{ Address: '', CachePeriodInMinutes: 1 - }]) + }]); }); it('evict invalid endpoint records from cache if InvalidEndpointException encountered', function() { @@ -301,7 +301,7 @@ describe('endpoint discovery', function() { accessKeyId: 'akid', region: 'fake-region-1', serviceId: 'MockService' - } + }; AWS.endpointCache.put(cacheKey, [{Address: 'https://cell1.fakeservice.amazonaws.com/fakeregion'}]); var cacheRemoveSpy = helpers.spyOn(AWS.endpointCache, 'remove').andCallThrough(); var request = client.makeRequest('optionalEDOperation', {Query: 'query'}); @@ -324,21 +324,21 @@ describe('endpoint discovery', function() { helpers.mockHttpResponse(200, {}, '{"Endpoints": [{"Address": "https://cell1.fakeservice.amazonaws.com/fakeregion", "CachePeriodInMinutes": 1}]}'); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { - spy(req) + if (req.operation === 'describeEndpoints') { + spy(req); } - }) + }); request.send(); expect(spy.calls.length).to.eql(1); expect(spy.calls[0].arguments[0].httpRequest.headers['x-amz-api-version']).to.eql('2018-09-19'); }); }); - + describe('requiredDiscoveryEndpoint', function() { - beforeEach(function(){ - AWS.endpointCache.empty() + beforeEach(function() { + AWS.endpointCache.empty(); }); - + it('fail when endpoint discovery fails', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -352,9 +352,9 @@ describe('endpoint discovery', function() { expect(data).to.eql(null); expect(err.code).to.eql('EndpointDiscoveryException'); expect(err.message).to.eql('Request cannot be fulfilled without specifying an endpoint'); - }) + }); }); - + it('endpoint operation will be called at the same rate of api requests', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -377,7 +377,7 @@ describe('endpoint discovery', function() { expect(apiRequestCount).to.eql(10); expect(endpointOperationRequestCount).to.eql(10); }); - + it('put in endpoint cache and use returned endpoint when endpoint discovery succeeds', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -423,7 +423,7 @@ describe('endpoint discovery', function() { region: 'mock-region', serviceId: 'MockService', Query: 'query' - } + }; AWS.endpointCache.put(cacheKey, [{Address: 'https://cell1.fakeservice.amazonaws.com/fakeregion', CachePeriodInMinutes: 1}]); var cacheRemoveSpy = helpers.spyOn(AWS.endpointCache, 'remove').andCallThrough(); var request = client.makeRequest('requiredEDOperation', {Query: 'query', Record: 'record'}); @@ -445,8 +445,8 @@ describe('endpoint discovery', function() { helpers.mockHttpResponse(200, {}, '{"Endpoints": [{"Address": "https://cell2.fakeservice.amazonaws.com/fakeregion", "CachePeriodInMinutes": 1}]}'); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { - spy(req) + if (req.operation === 'describeEndpoints') { + spy(req); } }); request.send(); @@ -479,7 +479,7 @@ describe('endpoint discovery', function() { AWS.events.on('build', function(req) { req.httpRequest.updateEndpoint('http://127.0.0.1:' + port); }); - + client = new AWS.Service({ endpointDiscoveryEnabled: true, apiConfig: new AWS.Model.Api(api), @@ -488,7 +488,7 @@ describe('endpoint discovery', function() { afterEach(function() { AWS.events.removeAllListeners(); - try {server.close()} catch(e) {}//fix service node running error in node 0.10 + try {server.close();} catch (e) {}//fix service node running error in node 0.10 }); it('endpoint operation succeed', function(done) { @@ -522,7 +522,7 @@ describe('endpoint discovery', function() { clearTimeout(timer); timer = null; } - } + }; for (var i = 0; i < concurrency; i++) { var request = client.makeRequest('requiredEDOperation', {Query: 'query', Record: 'record'}); request.send(function(err, data) { @@ -567,7 +567,7 @@ describe('endpoint discovery', function() { clearTimeout(timer); timer = null; } - } + }; var failedRequestCounter = 0; for (var i = 0; i < concurrency; i++) { var request = client.makeRequest('requiredEDOperation', {Query: 'query', Record: 'record'}); @@ -591,12 +591,12 @@ describe('endpoint discovery', function() { }); } }); - + describe('discoverEndpoints', function() { - beforeEach(function(){ + beforeEach(function() { AWS.endpointCache.empty(); }); - + it('accesses a single global endpoint cache for different services', function() { var clientOptions = { endpointDiscoveryEnabled: true, @@ -623,7 +623,7 @@ describe('endpoint discovery', function() { client2.makeRequest('requiredEDOperation', {}).send(); expect(putCacheCount).to.eql(2); }); - + it('default not run endpoint operation for optional endpoint discovery', function() { var client = new AWS.Service({ apiConfig: new AWS.Model.Api(api) @@ -638,7 +638,7 @@ describe('endpoint discovery', function() { client.makeRequest('optionalEDOperation', {Query: 'query'}).send(); expect(putInCacheSpy.calls.length).to.eql(1); }); - + it('if endpoint specified for client, custom endpoint should be preferred', function() { var client = new AWS.Service({ apiConfig: new AWS.Model.Api(api), @@ -648,13 +648,13 @@ describe('endpoint discovery', function() { var error; try { client.makeRequest('optionalEDOperation', {Query: 'query'}).build(); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.eql(null); expect(error.code).to.eql('ConfigurationException'); expect(error.message).to.eql('Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.'); - + client = new AWS.Service({ apiConfig: new AWS.Model.Api(api), endpoint: 'custom-endpoint.amazonaws.com/fake-region', @@ -663,9 +663,9 @@ describe('endpoint discovery', function() { client.makeRequest('requiredEDOperation', {Query: 'query', Record: 'record'}).send(); expect(getFromCacheSpy.calls.length).to.eql(0); }); - + it('if endpoint specified in global config, custom endpoint should be preferred', function() { - AWS.config.update({endpoint: 'custom-endpoint.amazonaws.com/fake-region'}) + AWS.config.update({endpoint: 'custom-endpoint.amazonaws.com/fake-region'}); client = new AWS.Service({ apiConfig: new AWS.Model.Api(api), }); @@ -674,9 +674,9 @@ describe('endpoint discovery', function() { expect(getFromCacheSpy.calls.length).to.eql(0); delete AWS.config.endpoint; }); - + it('if endpoint specified in global config, custom endpoint should be preferred', function() { - AWS.config.update({mock: {endpoint: 'custom-endpoint.amazonaws.com/fake-region'}}) + AWS.config.update({mock: {endpoint: 'custom-endpoint.amazonaws.com/fake-region'}}); var MockService = helpers.MockServiceFromApi(api); var client = new MockService({}); var getFromCacheSpy = helpers.spyOn(AWS.endpointCache, 'get').andCallThrough(); @@ -684,7 +684,7 @@ describe('endpoint discovery', function() { expect(getFromCacheSpy.calls.length).to.eql(0); delete AWS.config.mock; }); - + it('append "endpoint-discovery" to user-agent on all requests', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: true, @@ -693,7 +693,7 @@ describe('endpoint discovery', function() { helpers.mockHttpResponse(200, {}, '{"Endpoints": [{"Address": "https://cell1.fakeservice.amazonaws.com/fakeregion", "CachePeriodInMinutes": 1}]}'); var request = client.makeRequest('requiredEDOperation', {Query: 'query', Record: 'record'}); request.send(); - if(AWS.util.isNode()) { + if (AWS.util.isNode()) { expect(request.httpRequest.headers['User-Agent']).include('endpoint-discovery'); } else { expect(request.httpRequest.headers['X-Amz-User-Agent']).include('endpoint-discovery'); @@ -701,7 +701,7 @@ describe('endpoint discovery', function() { request = client.makeRequest('optionalEDOperation', {Query: 'query'}); request.send(); - if(AWS.util.isNode()) { + if (AWS.util.isNode()) { expect(request.httpRequest.headers['User-Agent']).include('endpoint-discovery'); } else { expect(request.httpRequest.headers['X-Amz-User-Agent']).include('endpoint-discovery'); @@ -727,15 +727,15 @@ describe('endpoint discovery', function() { }); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { + if (req.operation === 'describeEndpoints') { spy(req); } - }) + }); helpers.mockHttpResponse(200, {}, '{"Endpoints": [{"Address": "https://cell1.fakeservice.amazonaws.com/fakeregion", "CachePeriodInMinutes": 1}]}'); client.makeRequest('optionalEDOperation', {Query: 'query'}).send(); client.makeRequest('requiredEDOperation', {Query: 'query', Record: 'record'}).send(); expect(spy.calls.length).to.eql(0); - }) + }); it('turn on endpoint discovery in client config', function() { @@ -745,7 +745,7 @@ describe('endpoint discovery', function() { }); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { + if (req.operation === 'describeEndpoints') { spy(req); } }); @@ -763,7 +763,7 @@ describe('endpoint discovery', function() { }); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { + if (req.operation === 'describeEndpoints') { spy(req); } }); @@ -782,7 +782,7 @@ describe('endpoint discovery', function() { }); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { + if (req.operation === 'describeEndpoints') { spy(req); } }); @@ -798,7 +798,7 @@ describe('endpoint discovery', function() { var error; try { request.send(); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.eql(undefined); @@ -813,7 +813,7 @@ describe('endpoint discovery', function() { }); var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { + if (req.operation === 'describeEndpoints') { spy(req); } }); @@ -829,14 +829,14 @@ describe('endpoint discovery', function() { var error; try { request.send(); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.eql(undefined); expect(error.code).to.eql('ConfigurationException'); expect(error.message).to.eql('environmental variable AWS_ENDPOINT_DISCOVERY_ENABLED cannot be set to nothing'); }); - + it('turn on endpoint discovery from config file', function() { var client = new AWS.Service({ endpointDiscoveryEnabled: false, @@ -846,8 +846,8 @@ describe('endpoint discovery', function() { process.env.AWS_PROFILE = 'dummyRole'; var spy = helpers.createSpy('send inject'); AWS.events.on('sign', function(req) { - if(req.operation === 'describeEndpoints') { - spy(req) + if (req.operation === 'describeEndpoints') { + spy(req); } }); helpers.mockHttpResponse(200, {}, '{"Endpoints": [{"Address": "https://cell1.fakeservice.amazonaws.com/fakeregion", "CachePeriodInMinutes": 1}]}'); @@ -861,7 +861,7 @@ describe('endpoint discovery', function() { var error; try { request.send(); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.eql(undefined); @@ -870,4 +870,4 @@ describe('endpoint discovery', function() { }); } }); -}); \ No newline at end of file +}); diff --git a/test/dynamodb/converter.spec.js b/test/dynamodb/converter.spec.js index c80dfb5b7b..b90e427f40 100644 --- a/test/dynamodb/converter.spec.js +++ b/test/dynamodb/converter.spec.js @@ -537,6 +537,6 @@ describe('AWS.DynamoDB.Converter', function() { expect(unmarshalled.map.nestedMap.numberKey.toString()) .to.equal('9007199254740991000'); - }) + }); }); }); diff --git a/test/dynamodb/document_client.spec.js b/test/dynamodb/document_client.spec.js index 3597fa8cff..2130682860 100644 --- a/test/dynamodb/document_client.spec.js +++ b/test/dynamodb/document_client.spec.js @@ -33,7 +33,7 @@ it('validates type of set', function() { return expect(function() { return docClient.createSet([true, false, false]); - }).to["throw"]('Sets can contain string, number, or binary values'); + }).to['throw']('Sets can contain string, number, or binary values'); }); it('detects type of sets', function() { @@ -52,29 +52,29 @@ return docClient.createSet([1, 2, 'string'], { validate: true }); - }).to["throw"]('Number Set contains String value'); + }).to['throw']('Number Set contains String value'); expect(function() { return docClient.createSet(['string', 'string', 2], { validate: true }); - }).to["throw"]('String Set contains Number value'); + }).to['throw']('String Set contains Number value'); expect(function() { return docClient.createSet([1, 2, new Buffer('foo')], { validate: true }); - }).to["throw"]('Number Set contains Binary value'); + }).to['throw']('Number Set contains Binary value'); }); it('does not validate set elements if validate: true unset', function() { expect(function() { return docClient.createSet([1, 2, 'string']); - }).to.not["throw"]('Number Set contains String value'); + }).to.not['throw']('Number Set contains String value'); expect(function() { return docClient.createSet(['string', 'string', 2]); - }).to.not["throw"]('String Set contains Number value'); + }).to.not['throw']('String Set contains Number value'); expect(function() { return docClient.createSet([1, 2, new Buffer('foo')]); - }).to.not["throw"]('Number Set contains Binary value'); + }).to.not['throw']('Number Set contains Binary value'); }); }); @@ -1624,7 +1624,7 @@ fill(new Error('error!'), null, true); expect(function() { response.nextPage(); - }).to["throw"]('error!'); + }).to['throw']('error!'); }); it('sends the request if passed with a callback', function(done) { diff --git a/test/dynamodb/numberValue.spec.js b/test/dynamodb/numberValue.spec.js index 2caee1b233..68b4aee1a9 100644 --- a/test/dynamodb/numberValue.spec.js +++ b/test/dynamodb/numberValue.spec.js @@ -37,4 +37,4 @@ describe('NumberValue', function() { } })).to.equal('{"number":123,"nested":{"number":234}}'); }); -}); \ No newline at end of file +}); diff --git a/test/endpoint.spec.js b/test/endpoint.spec.js index 7c33beaad0..c5f7742ab0 100644 --- a/test/endpoint.spec.js +++ b/test/endpoint.spec.js @@ -8,10 +8,10 @@ it('throws error if parameter is null/undefined', function() { expect(function() { return new AWS.Endpoint(null); - }).to["throw"]('Invalid endpoint: null'); + }).to['throw']('Invalid endpoint: null'); return expect(function() { return new AWS.Endpoint(void 0); - }).to["throw"]('Invalid endpoint: undefined'); + }).to['throw']('Invalid endpoint: undefined'); }); it('copy constructs Endpoint', function() { var endpoint, origEndpoint; diff --git a/test/event-stream/buffered-create-event-stream.spec.js b/test/event-stream/buffered-create-event-stream.spec.js index 2ad6d87caf..2eeef97466 100644 --- a/test/event-stream/buffered-create-event-stream.spec.js +++ b/test/event-stream/buffered-create-event-stream.spec.js @@ -73,4 +73,4 @@ describe('buffered createEventStream', function() { var eventStream = createEventStream(payload, parser, mockEventStreamShape); }).to.throw('Event Error').with.property('name', 'FooError'); }); -}); \ No newline at end of file +}); diff --git a/test/event-stream/event-message-chunker-stream.spec.js b/test/event-stream/event-message-chunker-stream.spec.js index a2af7e4781..1817cbd869 100644 --- a/test/event-stream/event-message-chunker-stream.spec.js +++ b/test/event-stream/event-message-chunker-stream.spec.js @@ -141,4 +141,4 @@ if (Transform) { }); }); }); -} \ No newline at end of file +} diff --git a/test/event-stream/event-message-chunker.spec.js b/test/event-stream/event-message-chunker.spec.js index f785a7c791..eae359e807 100644 --- a/test/event-stream/event-message-chunker.spec.js +++ b/test/event-stream/event-message-chunker.spec.js @@ -30,4 +30,4 @@ describe('eventMessageChunker', function() { expect(messages[i].toString('base64')).to.equal(mockEventMessages[i].toString('base64')); } }); -}); \ No newline at end of file +}); diff --git a/test/event-stream/event-message-unmarshaller-stream.spec.js b/test/event-stream/event-message-unmarshaller-stream.spec.js index d4d40672f4..b12ece47a9 100644 --- a/test/event-stream/event-message-unmarshaller-stream.spec.js +++ b/test/event-stream/event-message-unmarshaller-stream.spec.js @@ -54,4 +54,4 @@ if (stream.Transform) { eventUnmarshallerStream.end(); }); }); -} \ No newline at end of file +} diff --git a/test/event-stream/int64.spec.js b/test/event-stream/int64.spec.js index 530e75791e..06e8864ec5 100644 --- a/test/event-stream/int64.spec.js +++ b/test/event-stream/int64.spec.js @@ -55,13 +55,13 @@ describe('Int64', function() { it('should throw when a number larger than 2^63 -1 is provided', function() { expect(function() { - Int64.fromNumber(9323372036854775807) + Int64.fromNumber(9323372036854775807); }).to.throw(); }); it('should throw when a number smaller than -1 * 2^63 is provided', function() { expect(function() { - Int64.fromNumber(-9323372036854775807) + Int64.fromNumber(-9323372036854775807); }).to.throw(); }); -}); \ No newline at end of file +}); diff --git a/test/event-stream/mock-event-message-source-stream.fixture.js b/test/event-stream/mock-event-message-source-stream.fixture.js index 43404951f1..b7ac3525af 100644 --- a/test/event-stream/mock-event-message-source-stream.fixture.js +++ b/test/event-stream/mock-event-message-source-stream.fixture.js @@ -40,4 +40,4 @@ MockEventMessageSource.prototype._read = function() { module.exports = { MockEventMessageSource: MockEventMessageSource -}; \ No newline at end of file +}; diff --git a/test/event-stream/parse-event.spec.js b/test/event-stream/parse-event.spec.js index 047dc7c143..6cb10dea37 100644 --- a/test/event-stream/parse-event.spec.js +++ b/test/event-stream/parse-event.spec.js @@ -133,4 +133,4 @@ describe('parseEvent', function() { parseEvent(mockParser, eventMessage, mockEventStreamShape); }).to.throw('Event Error').with.property('name', 'FooError'); }); -}); \ No newline at end of file +}); diff --git a/test/event-stream/parse-message.spec.js b/test/event-stream/parse-message.spec.js index 02bc5212d3..84d287a017 100644 --- a/test/event-stream/parse-message.spec.js +++ b/test/event-stream/parse-message.spec.js @@ -19,4 +19,4 @@ describe('message parsing', function() { }); })(vectorName, vector); } -}); \ No newline at end of file +}); diff --git a/test/event-stream/scripts/build-test-vectors-fixture.js b/test/event-stream/scripts/build-test-vectors-fixture.js index 1a4cf486c8..6090e01661 100644 --- a/test/event-stream/scripts/build-test-vectors-fixture.js +++ b/test/event-stream/scripts/build-test-vectors-fixture.js @@ -1,4 +1,3 @@ -/*eslint-disable */ const { Buffer } = require('buffer'); const { readdirSync, @@ -52,7 +51,7 @@ for (const dirName of ['positive', 'negative']) { value: ${headerValue(declaration.type, declaration.value)}, },` ) - .join('\n') + .join('\n'); vectors += ` decoded: { @@ -61,10 +60,10 @@ ${headers} }, body: ${writeBuffer(Buffer.from(decoded.payload, 'base64'))}, }, -` +`; } - vectors += " },\n" + vectors += ' },\n'; } } @@ -97,7 +96,7 @@ function headerValue(type, vectorRepresentation) { return `new Date(${vectorRepresentation})`; case 9: const hex = Buffer.from(vectorRepresentation, 'base64').toString('hex'); - return `'${hex.substr(0, 8)}-${hex.substr(8, 4)}-${hex.substr(12, 4)}-${hex.substr(16, 4)}-${hex.substr(20)}'` + return `'${hex.substr(0, 8)}-${hex.substr(8, 4)}-${hex.substr(12, 4)}-${hex.substr(16, 4)}-${hex.substr(20)}'`; default: return vectorRepresentation; } diff --git a/test/event-stream/split-message.spec.js b/test/event-stream/split-message.spec.js index e265e468d4..a5179ebb11 100644 --- a/test/event-stream/split-message.spec.js +++ b/test/event-stream/split-message.spec.js @@ -67,5 +67,5 @@ describe('splitMessage', function() { body: emptyBuffer }); } - ) -}); \ No newline at end of file + ); +}); diff --git a/test/event-stream/streaming-create-event-stream.spec.js b/test/event-stream/streaming-create-event-stream.spec.js index 69f0d8c0b8..d3cc5c7ec3 100644 --- a/test/event-stream/streaming-create-event-stream.spec.js +++ b/test/event-stream/streaming-create-event-stream.spec.js @@ -18,7 +18,7 @@ if (stream.Transform) { testEventMessages.recordEventMessage, testEventMessages.statsEventMessage, testEventMessages.endEventMessage - ], 10) + ], 10); var expectedEvents = [ { @@ -78,7 +78,7 @@ if (stream.Transform) { errorEventMessage, testEventMessages.statsEventMessage, testEventMessages.endEventMessage - ], 10) + ], 10); var eventStream = createEventStream(mockHttpResponse, parser, mockEventStreamShape); @@ -132,4 +132,4 @@ if (stream.Transform) { }); }); }); -} \ No newline at end of file +} diff --git a/test/event-stream/test-event-messages.fixture.js b/test/event-stream/test-event-messages.fixture.js index 3faa5bc3e9..2f62537910 100644 --- a/test/event-stream/test-event-messages.fixture.js +++ b/test/event-stream/test-event-messages.fixture.js @@ -20,4 +20,4 @@ module.exports = { endEventMessage: endEventMessage, recordEventMessage: recordEventMessage, statsEventMessage: statsEventMessage -}; \ No newline at end of file +}; diff --git a/test/event-stream/test-event-stream-model.fixture.js b/test/event-stream/test-event-stream-model.fixture.js index 71d66753f2..9656cca381 100644 --- a/test/event-stream/test-event-stream-model.fixture.js +++ b/test/event-stream/test-event-stream-model.fixture.js @@ -109,4 +109,4 @@ var mockEventStreamShape = Shape.create({ module.exports = { mockEventStreamShape: mockEventStreamShape -}; \ No newline at end of file +}; diff --git a/test/event_listeners.spec.js b/test/event_listeners.spec.js index 847ad78d6b..ea9f4128c6 100644 --- a/test/event_listeners.spec.js +++ b/test/event_listeners.spec.js @@ -68,17 +68,17 @@ return request; } }; - + describe('validate', function() { it('takes the request object as a parameter', function() { var request, response; request = makeRequest(); request.on('validate', function(req) { expect(req).to.equal(request); - throw "ERROR"; + throw 'ERROR'; }); response = request.send(function() {}); - return expect(response.error.message).to.equal("ERROR"); + return expect(response.error.message).to.equal('ERROR'); }); it('sends error event if credentials are not set', function() { service.config.credentialProvider = null; @@ -86,10 +86,10 @@ makeRequest(function() {}); expect(errorHandler.calls.length).not.to.equal(0); return AWS.util.arrayEach(errorHandler.calls, function(call) { - expect(call["arguments"][0]).to.be.instanceOf(Error); - expect(call["arguments"][0].code).to.equal('CredentialsError'); - expect(call["arguments"][0].name).to.equal('CredentialsError'); - return expect(call["arguments"][0].message).to.match(/Missing credentials/); + expect(call['arguments'][0]).to.be.instanceOf(Error); + expect(call['arguments'][0].code).to.equal('CredentialsError'); + expect(call['arguments'][0].name).to.equal('CredentialsError'); + return expect(call['arguments'][0].message).to.match(/Missing credentials/); }); }); it('sends error event if credentials are not set', function() { @@ -98,10 +98,10 @@ makeRequest(function() {}); expect(errorHandler.calls.length).not.to.equal(0); return AWS.util.arrayEach(errorHandler.calls, function(call) { - expect(call["arguments"][0]).to.be.instanceOf(Error); - expect(call["arguments"][0].code).to.equal('CredentialsError'); - expect(call["arguments"][0].name).to.equal('CredentialsError'); - return expect(call["arguments"][0].message).to.match(/Missing credentials/); + expect(call['arguments'][0]).to.be.instanceOf(Error); + expect(call['arguments'][0].code).to.equal('CredentialsError'); + expect(call['arguments'][0].name).to.equal('CredentialsError'); + return expect(call['arguments'][0].message).to.match(/Missing credentials/); }); }); it('does not validate credentials if request is not signed', function() { @@ -125,9 +125,9 @@ request = makeRequest(function() {}); call = errorHandler.calls[0]; expect(errorHandler.calls.length).not.to.equal(0); - expect(call["arguments"][0]).to.be.instanceOf(Error); - expect(call["arguments"][0].code).to.equal('ConfigError'); - return expect(call["arguments"][0].message).to.match(/Missing region in config/); + expect(call['arguments'][0]).to.be.instanceOf(Error); + expect(call['arguments'][0].code).to.equal('ConfigError'); + return expect(call['arguments'][0].message).to.match(/Missing region in config/); }); return it('ignores region validation if service has global endpoint', function() { helpers.mockHttpResponse(200, {}, ''); @@ -146,10 +146,10 @@ request = makeRequest(); request.on('build', function(req) { expect(req).to.equal(request); - throw "ERROR"; + throw 'ERROR'; }); response = request.send(function() {}); - return expect(response.error.message).to.equal("ERROR"); + return expect(response.error.message).to.equal('ERROR'); }); }); @@ -208,7 +208,7 @@ var req = service.putStream({ Body: require('fs').createReadStream(__filename) }); - + req.runTo('sign', function(err) { expect(req.httpRequest.headers['Content-Length'] > 0).to.equal(true); expect(!err).to.equal(true); @@ -220,7 +220,7 @@ var req = service.putStream({ Body: new AWS.util.stream.Readable() }); - + req.runTo('sign', function(err) { expect(typeof req.httpRequest.headers['Content-Length']).to.equal('undefined'); expect(!err).to.equal(true); @@ -294,10 +294,10 @@ request = makeRequest(); request.on('sign', function(req) { expect(req).to.equal(request); - throw "ERROR"; + throw 'ERROR'; }); response = request.send(function() {}); - return expect(response.error.message).to.equal("ERROR"); + return expect(response.error.message).to.equal('ERROR'); }); it('uses the api.signingName if provided', function() { var request, response; @@ -865,10 +865,10 @@ operations: { mockMethod: { input: { - type: "structure", + type: 'structure', members: { foo: { - type: "string", + type: 'string', sensitive: true } } @@ -876,8 +876,8 @@ output: {} } } - } - }) + }; + }); it('with sensitive trait in shape\'s own property', function() { var api = new AWS.Model.Api(apiJSON); @@ -898,10 +898,10 @@ operations: { mockMethod: { input: { - type: "structure", + type: 'structure', members: { foo: { - shape: "S1" + shape: 'S1' }, baz: { type: 'structure', @@ -920,7 +920,7 @@ sensitive: true } } - }) + }); var CustomMockService = MockServiceFromApi(api); service = new CustomMockService({logger: logger}); helpers.mockHttpResponse(200, {}, []); @@ -943,7 +943,7 @@ member: { sensitive: true } - } + }; var api = new AWS.Model.Api(apiJSON); var CustomMockService = MockServiceFromApi(api); service = new CustomMockService({logger: logger}); @@ -966,7 +966,7 @@ type: 'string', sensitive: true } - } + }; var api = new AWS.Model.Api(apiJSON); var CustomMockService = MockServiceFromApi(api); service = new CustomMockService({logger: logger}); @@ -996,7 +996,7 @@ } } } - } + }; var api = new AWS.Model.Api(apiJSON); var CustomMockService = MockServiceFromApi(api); service = new CustomMockService({logger: logger}); @@ -1009,11 +1009,11 @@ }).send(); expect(data.indexOf('secret_key_id')).to.equal(-1); expect(data.indexOf('secret_access_key')).to.equal(-1); - }) + }); it('from input shape of scalars', function() { var allShapeTypes = ['boolean', 'timestamp', 'float','integer', 'string', 'base64', 'binary']; - Array.prototype.forEach.call(allShapeTypes, function(shapeType){ + Array.prototype.forEach.call(allShapeTypes, function(shapeType) { apiJSON.operations.mockMethod.input.members.foo = { type: shapeType, sensitive: true @@ -1027,7 +1027,7 @@ foo: '1234567' }).send(); expect(data.indexOf('1234567')).to.equal(-1); - }) + }); }); it('from input of undefined', function() { @@ -1052,7 +1052,7 @@ expect(data.indexOf('bar: \'bar\'') >= 0).to.equal(true); expect(data.indexOf('undefined') >= 0).to.equal(true); expect(data.indexOf('{}')).to.equal(-1); - }) + }); }); describe('terminal callback error handling', function() { @@ -1065,7 +1065,7 @@ return makeRequest(function() { return invalidCode; }); - }).to["throw"](); + }).to['throw'](); expect(completeHandler.calls.length).to.equal(1); expect(errorHandler.calls.length).to.equal(0); return expect(retryHandler.calls.length).to.equal(0); @@ -1079,7 +1079,7 @@ return request.send(function() { return invalidCode; }); - }).to["throw"](); + }).to['throw'](); return expect(completeHandler.calls.length).not.to.equal(0); }); }); @@ -1123,7 +1123,7 @@ expect(function() { request.send(); - }).not.to["throw"](); + }).not.to['throw'](); expect(completeHandler.calls.length).not.to.equal(0); expect(retryHandler.calls.length).to.equal(0); diff --git a/test/foo-service.fixture.js b/test/foo-service.fixture.js index fe8d010595..fb67339736 100644 --- a/test/foo-service.fixture.js +++ b/test/foo-service.fixture.js @@ -2,49 +2,49 @@ var AWS = require('./helpers').AWS; var Api = require('../lib/model/api'); var model = { - "version": "2.0", - "metadata": { - "apiVersion": "2018-06-13", - "endpointPrefix": "foo", - "protocol": "rest-json", - "serviceAbbreviation": "Foo Service", - "serviceFullName": "Awesome Foo Service", - "serviceId": "Foo", - "signatureVersion": "v4", - "signingName": "foo", - "uid": "foo-2018-06-13" + 'version': '2.0', + 'metadata': { + 'apiVersion': '2018-06-13', + 'endpointPrefix': 'foo', + 'protocol': 'rest-json', + 'serviceAbbreviation': 'Foo Service', + 'serviceFullName': 'Awesome Foo Service', + 'serviceId': 'Foo', + 'signatureVersion': 'v4', + 'signingName': 'foo', + 'uid': 'foo-2018-06-13' }, - "operations": { - "PutStream": { - "http": { - "method": "PUT", - "requestUri": "/" + 'operations': { + 'PutStream': { + 'http': { + 'method': 'PUT', + 'requestUri': '/' }, - "input": { - "type": "structure", - "required": [ - "Body" + 'input': { + 'type': 'structure', + 'required': [ + 'Body' ], - "members": { - "Body": { - "shape": "StreamingBody" + 'members': { + 'Body': { + 'shape': 'StreamingBody' } }, - "payload": "Body" + 'payload': 'Body' }, - "authtype": "v4-unsigned-body" + 'authtype': 'v4-unsigned-body' } }, - "shapes": { - "StreamingBody": { - "type": "blob", - "streaming": true + 'shapes': { + 'StreamingBody': { + 'type': 'blob', + 'streaming': true } } -} +}; var FooService = AWS.Service.defineService(new Api(model)); module.exports = { FooService: FooService -}; \ No newline at end of file +}; diff --git a/test/helpers.js b/test/helpers.js index 4cb84d0bdc..120370a6c3 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -75,7 +75,7 @@ spy = function() { spy.calls.push({ object: this, - "arguments": Array.prototype.slice.call(arguments) + 'arguments': Array.prototype.slice.call(arguments) }); if (spy.callFn) { return spy.callFn.apply(spy.object, arguments); @@ -188,7 +188,7 @@ }, api: new AWS.Model.Api(customApi) }); - } + }; mockHttpSuccessfulResponse = function(status, headers, data, cb) { var httpResp; diff --git a/test/http_request.spec.js b/test/http_request.spec.js index 34d706dc13..657077efce 100644 --- a/test/http_request.spec.js +++ b/test/http_request.spec.js @@ -78,9 +78,9 @@ host: 'another.com:5678', protocol: 'https:', href: 'https://another.com:5678/path/service?foo=3&foo.options=5' - }) - }) - }) + }); + }); + }); describe('getUserAgentHeaderName', function() { it('provides the correct header for browser environments', function() { helpers.spyOn(AWS.util, 'isBrowser').andReturn(true); diff --git a/test/idempotent.spec.js b/test/idempotent.spec.js index fd5ab77277..cd0a3cbbf4 100644 --- a/test/idempotent.spec.js +++ b/test/idempotent.spec.js @@ -75,4 +75,4 @@ describe('AWS.EventListeners.Core.BUILD_IDEMPOTENCY_TOKENS', function() { done(); }); -}); \ No newline at end of file +}); diff --git a/test/json/builder.spec.js b/test/json/builder.spec.js index b1dd333cdf..319a928556 100644 --- a/test/json/builder.spec.js +++ b/test/json/builder.spec.js @@ -28,7 +28,7 @@ }; return describe('build', function() { it('returns an empty document when there are no params', function() { - return expect(build({}, {})).to.equal("{}"); + return expect(build({}, {})).to.equal('{}'); }); describe('structures', function() { var rules; @@ -154,8 +154,8 @@ now.setMilliseconds(100); params = { Items: { - MyKey: "5", - MyOtherKey: "10" + MyKey: '5', + MyOtherKey: '10' } }; str = '{"Items":{"MyKey":5,"MyOtherKey":10}}'; diff --git a/test/json/parser.spec.js b/test/json/parser.spec.js index 0cbd5e81b0..89fc0d3ef9 100644 --- a/test/json/parser.spec.js +++ b/test/json/parser.spec.js @@ -56,9 +56,9 @@ var params; params = '{ "Items": { "A": "a", "B": "b" } }'; return expect(parse(rules, params)).to.eql({ - "Items": { - "A": "a", - "B": "b" + 'Items': { + 'A': 'a', + 'B': 'b' } }); }); diff --git a/test/metadata_service.spec.js b/test/metadata_service.spec.js index 43d2886376..05180a3410 100644 --- a/test/metadata_service.spec.js +++ b/test/metadata_service.spec.js @@ -112,7 +112,7 @@ if (AWS.util.isNode()) { }); service = new AWS.MetadataService(options); service.loadCredentials(function(err, data) { - expect(err).to.be["null"]; + expect(err).to.be['null']; expect(data.AccessKeyId).to.equal('KEY'); expect(spy.calls.length).to.equal(3); done(); @@ -130,7 +130,7 @@ if (AWS.util.isNode()) { service = new AWS.MetadataService(options); service.loadCredentials(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; + expect(err).to.not.be['null']; expect(err.code).to.equal('TimeoutError'); expect(spy.calls.length).to.equal(6); done(); diff --git a/test/mocks/shaky-stream.js b/test/mocks/shaky-stream.js index be2d324d7d..7ea762498b 100644 --- a/test/mocks/shaky-stream.js +++ b/test/mocks/shaky-stream.js @@ -42,4 +42,4 @@ ShakyStream.prototype._read = function _read(size) { } }; -module.exports = ShakyStream; \ No newline at end of file +module.exports = ShakyStream; diff --git a/test/model/api.spec.js b/test/model/api.spec.js index 61a98fbcf0..b20f0003ff 100644 --- a/test/model/api.spec.js +++ b/test/model/api.spec.js @@ -114,7 +114,7 @@ expect(api.operations.someOperation.endpointDiscoveryRequired).to.equal('NULL'); expect(api.operations.optionalEndpointOperation.endpointDiscoveryRequired).to.equal('OPTIONAL'); expect(api.operations.requiredEndpointOperation.endpointDiscoveryRequired).to.equal('REQUIRED'); - }) + }); }); describe('documentation', function() { diff --git a/test/model/shape.spec.js b/test/model/shape.spec.js index 441a1640c5..506d8fadd5 100644 --- a/test/model/shape.spec.js +++ b/test/model/shape.spec.js @@ -234,7 +234,7 @@ expect(shape.members.Date.timestampFormat).to.eql('iso8601'); }); }); - + describe('toType()', function() { it('converts unix timestamps', function() { var api, date, shape; diff --git a/test/node_http_client.spec.js b/test/node_http_client.spec.js index 0d81583059..f510c43711 100644 --- a/test/node_http_client.spec.js +++ b/test/node_http_client.spec.js @@ -170,7 +170,7 @@ expect(setTimeoutSpy.calls.length).to.equal(1); mockSocket.emit('connect'); expect(clearTimeoutSpy.calls.length).to.equal(1); - expect(clearTimeoutSpy.calls[0]["arguments"][0]).to.equal(timeoutId); + expect(clearTimeoutSpy.calls[0]['arguments'][0]).to.equal(timeoutId); }); it('clears timeouts if an error is encountered', function() { @@ -188,8 +188,8 @@ expect(setTimeoutSpy.calls.length).to.equal(1); mockClientRequest.emit('error', new Error('Something happened!')); expect(clearTimeoutSpy.calls.length).to.equal(1); - expect(clearTimeoutSpy.calls[0]["arguments"][0]).to.equal(timeoutId); - }) + expect(clearTimeoutSpy.calls[0]['arguments'][0]).to.equal(timeoutId); + }); }); }); }); diff --git a/test/param_validator.spec.js b/test/param_validator.spec.js index 9afb722b03..992915754c 100644 --- a/test/param_validator.spec.js +++ b/test/param_validator.spec.js @@ -31,7 +31,7 @@ } return expect(function() { return validate(params, strict); - }).to["throw"](message); + }).to['throw'](message); }; describe('empty input', function() { beforeEach(function() { @@ -119,7 +119,7 @@ location: 'uri' } } - } + }; }); it('throws an error if a uri parameter is empty', function() { @@ -869,7 +869,7 @@ }); it('throws helpful messages for invalid strings', function() { var msg; - msg = "Expected params.config.settings.name to be a string"; + msg = 'Expected params.config.settings.name to be a string'; input.members.config.members.settings.members.name = { type: 'string' }; @@ -883,7 +883,7 @@ }); it('throws helpful messages for invalid integers', function() { var msg; - msg = "Expected params.config.settings.count to be a number"; + msg = 'Expected params.config.settings.count to be a number'; input.members.config.members.settings.members.count = { type: 'integer' }; @@ -897,7 +897,7 @@ }); it('throws helpful messages for invalid timestamps', function() { var msg; - msg = "Expected params.config.settings.when to be a " + "Date object, ISO-8601 string, or a UNIX timestamp"; + msg = 'Expected params.config.settings.when to be a ' + 'Date object, ISO-8601 string, or a UNIX timestamp'; input.members.config.members.settings.members.when = { type: 'timestamp' }; @@ -911,7 +911,7 @@ }); it('throws helpful messages for invalid booleans', function() { var msg; - msg = "Expected params.config.settings.enabled to be a boolean"; + msg = 'Expected params.config.settings.enabled to be a boolean'; return expectError(msg, { config: { settings: { @@ -922,7 +922,7 @@ }); it('throws helpful messages for invalid floats', function() { var msg; - msg = "Expected params.config.settings.value to be a number"; + msg = 'Expected params.config.settings.value to be a number'; input.members.config.members.settings.members.value = { type: 'float' }; @@ -936,7 +936,7 @@ }); it('throws helpful messages for invalid base64 params', function() { var msg; - msg = "Expected params.config.settings.data to be a " + "string, Buffer, Stream, Blob, or typed array object"; + msg = 'Expected params.config.settings.data to be a ' + 'string, Buffer, Stream, Blob, or typed array object'; input.members.config.members.settings.members.data = { type: 'base64' }; @@ -950,7 +950,7 @@ }); return it('throws helpful messages for invalid binary params', function() { var msg; - msg = "Expected params.config.settings.data to be a " + "string, Buffer, Stream, Blob, or typed array object"; + msg = 'Expected params.config.settings.data to be a ' + 'string, Buffer, Stream, Blob, or typed array object'; input.members.config.members.settings.members.data = { type: 'binary' }; @@ -978,7 +978,7 @@ } } }; - msg = "There were 2 validation errors:\n" + "* MissingRequiredParameter: Missing required key 'param2' in params\n" + "* InvalidParameterType: Expected params.param1 to be a boolean"; + msg = 'There were 2 validation errors:\n' + '* MissingRequiredParameter: Missing required key \'param2\' in params\n' + '* InvalidParameterType: Expected params.param1 to be a boolean'; return expectError(msg, { param1: 'notboolean' }); @@ -1205,7 +1205,7 @@ members: { str: { type: 'string', - "enum": ['Hemingway', 'Faulkner', 'Twain', 'Poe'] + 'enum': ['Hemingway', 'Faulkner', 'Twain', 'Poe'] }, map: { type: 'map', @@ -1214,7 +1214,7 @@ }, key: { type: 'string', - "enum": ['old', 'man', 'sea'] + 'enum': ['old', 'man', 'sea'] } } } @@ -1224,35 +1224,35 @@ return expectValid({ str: 'Dickens' }, { - "enum": false + 'enum': false }); }); it('accepts strings matching first enum value', function() { return expectValid({ str: 'Hemingway' }, { - "enum": true + 'enum': true }); }); it('accepts strings matching last enum value', function() { return expectValid({ str: 'Poe' }, { - "enum": true + 'enum': true }); }); it('rejects strings not in enum list', function() { return expectError('Found string value of Shakespeare, but expected ' + 'Hemingway|Faulkner|Twain|Poe for params.str', { str: 'Shakespeare' }, { - "enum": true + 'enum': true }); }); it('rejects strings not exactly in enum list', function() { return expectError('Found string value of twain, but expected ' + 'Hemingway|Faulkner|Twain|Poe for params.str', { str: 'twain' }, { - "enum": true + 'enum': true }); }); it('accepts map keys found in enum trait', function() { @@ -1261,7 +1261,7 @@ old: 'abc' } }, { - "enum": true + 'enum': true }); }); return it('rejects map keys not found in enum trait', function() { @@ -1270,7 +1270,7 @@ the: 'abc' } }, { - "enum": true + 'enum': true }); }); }); diff --git a/test/polly/presigner.spec.js b/test/polly/presigner.spec.js index 428b6671fc..508fcf395a 100644 --- a/test/polly/presigner.spec.js +++ b/test/polly/presigner.spec.js @@ -207,7 +207,7 @@ describe('AWS.Polly.Presigner', function() { expect(expires).to.equal(900); }); - it('supports being called with a callback with expires', function(done){ + it('supports being called with a callback with expires', function(done) { var expectedUrl = 'https://polly.us-west-2.amazonaws.com/v1/speech?OutputFormat=mp3&Text=Hello%20world&TextType=text&VoiceId=fake&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=akid%2F19700101%2Fus-west-2%2Fpolly%2Faws4_request&X-Amz-Date=19700101T000000Z&X-Amz-Expires=3600&X-Amz-Signature=ad22388e7298c19a491bc77b0c1fd8f169de31f031497a0266a15e1379520ff8&X-Amz-SignedHeaders=host'; presigner.getSynthesizeSpeechUrl({ TextType: 'text', @@ -234,4 +234,4 @@ describe('AWS.Polly.Presigner', function() { }); }); -}); \ No newline at end of file +}); diff --git a/test/protocol/helpers.spec.js b/test/protocol/helpers.spec.js index 95c6e81270..d3529149b8 100644 --- a/test/protocol/helpers.spec.js +++ b/test/protocol/helpers.spec.js @@ -12,67 +12,67 @@ describe('populateHostPrefix', function() { }, operations: { GetObject: { - name: "GetObject", + name: 'GetObject', http: { - method: "GET", - requestUri: "/{Key +}", + method: 'GET', + requestUri: '/{Key +}', responseCode: 200 }, endpoint: { - hostPrefix: "{Bucket}-{AccountId}-{Bucket}." + hostPrefix: '{Bucket}-{AccountId}-{Bucket}.' }, - input: {"shape": "GetObjectInput"}, - output: {"shape": "GetObjectOutput"} + input: {'shape': 'GetObjectInput'}, + output: {'shape': 'GetObjectOutput'} }, GetObjectV2: { - name: "GetObjectV2", + name: 'GetObjectV2', http: { - method: "GET", - requestUri: "/{Key +}", + method: 'GET', + requestUri: '/{Key +}', responseCode: 200 }, endpoint: { - hostPrefix: "service-" + hostPrefix: 'service-' }, - input: {"shape": "GetObjectV2Input"}, - output: {"shape": "GetObjectOutput"} + input: {'shape': 'GetObjectV2Input'}, + output: {'shape': 'GetObjectOutput'} }, }, shapes: { GetObjectInput: { - type: "structure", - required: ["AccountId", "Bucket", "Key"], + type: 'structure', + required: ['AccountId', 'Bucket', 'Key'], members: { AccountId: { - type: "string", + type: 'string', hostLabel: true, - locationName: "x-amz-account-id", - location: "header" + locationName: 'x-amz-account-id', + location: 'header' }, Bucket: { - type: "string", + type: 'string', hostLabel: true, - locationName: "x-amz-bucket", - location: "header" + locationName: 'x-amz-bucket', + location: 'header' }, Key: { - type: "string", - location: "uri" + type: 'string', + location: 'uri' } } }, GetObjectV2Input: { - type: "structure", + type: 'structure', required: [], members: {} }, GetObjectOutput: { - type: "structure", + type: 'structure', required: [], members: {} } } - } + }; it('should not apply host prefix if it\'s disabled', function() { var client = new AWS.Service({ apiConfig: new AWS.Model.Api(api), @@ -142,7 +142,7 @@ describe('populateHostPrefix', function() { Bucket: 'bucket', Key: 'key' })); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.equal(undefined); @@ -161,7 +161,7 @@ describe('populateHostPrefix', function() { Key: 'key', AccountId: '{abc}' })); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.equal(undefined); @@ -176,11 +176,11 @@ describe('populateHostPrefix', function() { Key: 'key', AccountId: stringTooLong })); - } catch(e) { + } catch (e) { error = e; } expect(error).not.to.equal(undefined); expect(error.code).to.equal('ValidationError'); expect(error.message).to.equal('Hostname label length should be between 1 to 63 characters, inclusive.'); }); -}) \ No newline at end of file +}); diff --git a/test/protocol/protocol.spec.js b/test/protocol/protocol.spec.js index cefccc443d..abfe281a10 100644 --- a/test/protocol/protocol.spec.js +++ b/test/protocol/protocol.spec.js @@ -57,7 +57,7 @@ shapes: group.shapes }; group.cases.forEach(function(_case, i) { - _case.op = "case" + (i + 1); + _case.op = 'case' + (i + 1); return api.operations[_case.op] = _case.given; }); svc = new AWS.Service({ @@ -112,7 +112,7 @@ return results; } if (data.host) { - expect(req.httpRequest.endpoint.hostname).to.equal(data.host) + expect(req.httpRequest.endpoint.hostname).to.equal(data.host); } }; diff --git a/test/protocol/query.spec.js b/test/protocol/query.spec.js index 26c959f8d4..1c23c69466 100644 --- a/test/protocol/query.spec.js +++ b/test/protocol/query.spec.js @@ -117,7 +117,7 @@ var extractError; extractError = function(body) { if (body === void 0) { - body = "\n InvalidArgument\n Provided param is bad\n"; + body = '\n InvalidArgument\n Provided param is bad\n'; } response.httpResponse.statusCode = 400; response.httpResponse.statusMessage = 'Bad Request'; @@ -146,20 +146,20 @@ }); it('returns an empty error when the body cannot be parsed', function() { extractError(JSON.stringify({ - "foo": "bar", - "fizz": ["buzz", "pop"] + 'foo': 'bar', + 'fizz': ['buzz', 'pop'] })); expect(response.error.code).to.equal(400); expect(response.error.message).to.equal('Bad Request'); return expect(response.data).to.equal(null); }); it('extracts error when inside ', function() { - extractError("\n \n \n codemsg\n \n \n"); + extractError('\n \n \n codemsg\n \n \n'); expect(response.error.code).to.equal('code'); return expect(response.error.message).to.equal('msg'); }); return it('extracts error when is nested', function() { - extractError("\n \n codemsg\n \n"); + extractError('\n \n codemsg\n \n'); expect(response.error.code).to.equal('code'); return expect(response.error.message).to.equal('msg'); }); @@ -172,7 +172,7 @@ return svc.extractData(response); }; it('parses the response using the operation output rules', function() { - extractData("\n \n abc\n 123\n \n"); + extractData('\n \n abc\n 123\n \n'); expect(response.error).to.equal(null); return expect(response.data).to.eql({ Data: { @@ -183,7 +183,7 @@ }); it('performs default xml parsing when output rule is missing', function() { delete service.api.operations.operationName.output; - extractData("\n \n abc\n 123\n \n"); + extractData('\n \n abc\n 123\n \n'); expect(response.error).to.equal(null); return expect(response.data).to.eql({ data: { @@ -194,7 +194,7 @@ }); it('removes wrapping result element if resultWrapper is set', function() { service.api.operations.operationName.output.resultWrapper = 'OperationNameResult'; - extractData("\n \n \n abc\n 12345.5\n \n \n"); + extractData('\n \n \n abc\n 12345.5\n \n \n'); expect(response.error).to.equal(null); return expect(response.data).to.eql({ Data: { @@ -204,7 +204,7 @@ }); }); it('extracts requestId from the response', function() { - extractData("\n 12345-abcde\n \n abc\n 123\n \n"); + extractData('\n 12345-abcde\n \n abc\n 123\n \n'); expect(response.requestId).to.equal('12345-abcde'); return expect(response.data).to.eql({ Data: { @@ -215,7 +215,7 @@ }); it('extracts requestId even if output members are absent', function() { delete service.api.operations.operationName.output; - extractData("\n 12345-abcde\n"); + extractData('\n 12345-abcde\n'); expect(response.requestId).to.equal('12345-abcde'); return expect(response.data).to.eql({ requestId: '12345-abcde' @@ -231,7 +231,7 @@ } }, 'foo'); service.api.operations.operationName.output.members.RequestId = shape; - extractData("\n 12345-abcde\n foo-bar\n \n abc\n 123\n \n"); + extractData('\n 12345-abcde\n foo-bar\n \n abc\n 123\n \n'); return expect(response.data).to.eql({ Data: { Name: 'abc', @@ -250,7 +250,7 @@ } }, 'foo'); service.api.operations.operationName.output.members.requestId = shape; - extractData("\n 12345-abcde\n foo-bar\n \n abc\n 123\n \n"); + extractData('\n 12345-abcde\n foo-bar\n \n abc\n 123\n \n'); return expect(response.data).to.eql({ Data: { Name: 'abc', diff --git a/test/protocol/rest.spec.js b/test/protocol/rest.spec.js index c6d8c7ba65..64244b7c92 100644 --- a/test/protocol/rest.spec.js +++ b/test/protocol/rest.spec.js @@ -239,7 +239,7 @@ request.params = { Foo: date, Bar: [date, date], - } + }; defop({ input: input, http: { @@ -258,9 +258,9 @@ member: { type: 'timestamp', } - } - expect(build().httpRequest.path).to.equal('/path?Bar=1970-01-01T01%3A00%3A00Z&Bar=1970-01-01T01%3A00%3A00Z&foo=3600') - }) + }; + expect(build().httpRequest.path).to.equal('/path?Bar=1970-01-01T01%3A00%3A00Z&Bar=1970-01-01T01%3A00%3A00Z&foo=3600'); + }); }); describe('headers', function() { beforeEach(function() { diff --git a/test/protocol/rest_xml.spec.js b/test/protocol/rest_xml.spec.js index 4aca354aa4..2cadb77877 100644 --- a/test/protocol/rest_xml.spec.js +++ b/test/protocol/rest_xml.spec.js @@ -224,7 +224,7 @@ } } }); - xml = "\n abc\n \n a\n b\n c\n \n \n \n foo1\n bar1\n \n \n foo2\n bar2\n \n \n"; + xml = '\n abc\n \n a\n b\n c\n \n \n \n foo1\n bar1\n \n \n foo2\n bar2\n \n \n'; build(); expect(request.httpRequest.method).to.equal('POST'); expect(request.httpRequest.path).to.equal('/bucket-name?limit=123&next-marker=marker'); @@ -281,14 +281,14 @@ } } }); - return helpers.matchXML(build().httpRequest.body, "\n member1\n member2\n"); + return helpers.matchXML(build().httpRequest.body, '\n member1\n member2\n'); }); }); describe('extractError', function() { var extractError; extractError = function(body) { if (body === void 0) { - body = "\n InvalidArgument\n Provided param is bad\n"; + body = '\n InvalidArgument\n Provided param is bad\n'; } response.httpResponse.statusCode = 400; response.httpResponse.statusMessage = 'Bad Request'; @@ -311,8 +311,8 @@ }); it('returns an empty error when the body cannot be parsed', function() { extractError(JSON.stringify({ - "foo": "bar", - "fizz": ["buzz", "pop"] + 'foo': 'bar', + 'fizz': ['buzz', 'pop'] })); expect(response.error).to.be.instanceOf(Error); expect(response.error.code).to.equal(400); @@ -320,12 +320,12 @@ return expect(response.data).to.equal(null); }); it('extracts error when inside ', function() { - extractError("\n \n \n codemsg\n \n \n"); + extractError('\n \n \n codemsg\n \n \n'); expect(response.error.code).to.equal('code'); return expect(response.error.message).to.equal('msg'); }); return it('extracts error when is nested', function() { - extractError("\n \n codemsg\n \n"); + extractError('\n \n codemsg\n \n'); expect(response.error.code).to.equal('code'); return expect(response.error.message).to.equal('msg'); }); @@ -352,7 +352,7 @@ } } }); - extractData("\n foo\n \n a\n b\n c\n \n"); + extractData('\n foo\n \n a\n b\n c\n \n'); return expect(response.data).to.eql({ Foo: 'foo', Bar: ['a', 'b', 'c'] diff --git a/test/publisher/configuration.spec.js b/test/publisher/configuration.spec.js index 03f95168bd..c19209db12 100644 --- a/test/publisher/configuration.spec.js +++ b/test/publisher/configuration.spec.js @@ -20,7 +20,7 @@ if (AWS.util.isNode()) { iniLoader.clearCachedFiles(); process.env = processEnv; }); - + describe('get configurations from environmental variable', function () { it('should correctly parse truthy value to true', function () { var enabled = ['1', 'true', 'whatever', 'X', '99']; @@ -34,7 +34,7 @@ if (AWS.util.isNode()) { }); } }); - + it('should correctly parse falsy value to false', function () { var disabled = ['0', 'false', '']; for (var i = 0; i < disabled.length; i++) { @@ -47,7 +47,7 @@ if (AWS.util.isNode()) { }); } }); - + it('should get port', function () { process.env.AWS_CSM_PORT = '31001'; helpers.spyOn(AWS.util, 'readFileSync').andReturn(''); @@ -66,9 +66,9 @@ if (AWS.util.isNode()) { port: undefined, clientId: 'client_id', }); - }) - }) - + }); + }); + describe('get configuration from config file', function () { it('should correctly parse truthy value to true', function () { var enabled = ['1', 'true', 'whatever', 'X', '99']; @@ -83,7 +83,7 @@ if (AWS.util.isNode()) { }); } }); - + it('should correctly parse falsy value to false', function () { var disabled = ['0', 'false', '']; for (var i = 0; i < disabled.length; i++) { @@ -105,8 +105,8 @@ if (AWS.util.isNode()) { port: undefined, clientId: undefined }); - }) - + }); + it('should get port', function () { helpers.spyOn(AWS.util, 'readFileSync').andReturn('[default]\ncsm_port=31001'); expect(monitoringConfig()).to.eql({ @@ -115,7 +115,7 @@ if (AWS.util.isNode()) { clientId: undefined, }); }); - + it('should get clientID', function () { helpers.spyOn(AWS.util, 'readFileSync').andReturn('[default]\ncsm_client_id=id'); expect(monitoringConfig()).to.eql({ @@ -123,9 +123,9 @@ if (AWS.util.isNode()) { port: undefined, clientId: 'id', }); - }) + }); }); - + describe('get configurations according to resolving chain', function () { it('should prefer environmental variables over config file', function () { process.env.AWS_PROFILE = 'role'; @@ -140,7 +140,7 @@ if (AWS.util.isNode()) { clientId: 'clientid', }); }); - + it('should not read shared config file if monitoring disabled from environment', function () { process.env.AWS_PROFILE = 'role'; process.env.AWS_CSM_ENABLED = 'false'; @@ -150,24 +150,24 @@ if (AWS.util.isNode()) { return ''; }); expect(monitoringConfig().enabled).to.equal(false); - expect(ReadFileCalled).to.equal(0) - }) + expect(ReadFileCalled).to.equal(0); + }); }); it('should enable client-side monitoring globally if corresponding environment is set', function(done) { - process.env.AWS_CSM_ENABLED = "true"; + process.env.AWS_CSM_ENABLED = 'true'; AWS.Service.prototype.publisher = undefined; AWS.Service.defineService('acm', ['2015-12-08']); expect(AWS.Service.prototype.publisher).not.equal(undefined); - var publisherInvoked = false + var publisherInvoked = false; AWS.Service.prototype.publisher = { - eventHandler: function(event){ + eventHandler: function(event) { if (!publisherInvoked) { publisherInvoked = true; - done() //make sure publisher is invoked + done(); //make sure publisher is invoked } } - } + }; var client = new MockService({}); client.makeRequest('operationName', function(err, data) {}); }); @@ -177,17 +177,17 @@ if (AWS.util.isNode()) { AWS.Service.prototype.publisher = undefined; AWS.Service.defineService('acm', ['2015-12-08']); expect(AWS.Service.prototype.publisher).not.equal(undefined); - var publisherInvoked = false + var publisherInvoked = false; AWS.Service.prototype.publisher = { - eventHandler: function(event){ + eventHandler: function(event) { if (!publisherInvoked) { publisherInvoked = true; - done() //make sure publisher is invoked + done(); //make sure publisher is invoked } } - } + }; var client = new MockService({}); client.makeRequest('operationName', function(err, data) {}); }); - }) + }); } diff --git a/test/publisher/functional_test/cases.js b/test/publisher/functional_test/cases.js index b9fbe014c0..bad4e4054c 100644 --- a/test/publisher/functional_test/cases.js +++ b/test/publisher/functional_test/cases.js @@ -1,1128 +1,1128 @@ module.exports = { - "version": 1, - "defaults": { - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true" + 'version': 1, + 'defaults': { + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true' }, - "sharedConfigFile": {} + 'sharedConfigFile': {} }, - "optionalEventFields": { - "ApiCall": { - "ApiCallTimeout": "ANY_INT" + 'optionalEventFields': { + 'ApiCall': { + 'ApiCallTimeout': 'ANY_INT' }, - "ApiCallAttempt": { - "DestinationIp": "ANY_STR", - "AcquireConnectionLatency": "ANY_INT", - "ConnectionReused": "ANY_INT", - "ConnectLatency": "ANY_INT", - "RequestLatency": "ANY_INT", - "DnsLatency": "ANY_INT", - "TcpLatency": "ANY_INT", - "SslLatency": "ANY_INT" + 'ApiCallAttempt': { + 'DestinationIp': 'ANY_STR', + 'AcquireConnectionLatency': 'ANY_INT', + 'ConnectionReused': 'ANY_INT', + 'ConnectLatency': 'ANY_INT', + 'RequestLatency': 'ANY_INT', + 'DnsLatency': 'ANY_INT', + 'TcpLatency': 'ANY_INT', + 'SslLatency': 'ANY_INT' } } }, - "cases": [ + 'cases': [ { - "description": "Tests a single client API call with no configuration provided", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": {}, - "sharedConfigFile": {} + 'description': 'Tests a single client API call with no configuration provided', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': {}, + 'sharedConfigFile': {} }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [] + 'expectedMonitoringEvents': [] }, { - "description": "Test a single client API call", - "apiCalls": [ + 'description': 'Test a single client API call', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests a single client API call with bad request", - "apiCalls": [ + 'description': 'Tests a single client API call with bad request', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 400, - "responseHeaders": {}, - "errorCode": "TestOperationException", - "errorMessage": "There was an error" + 'httpStatus': 400, + 'responseHeaders': {}, + 'errorCode': 'TestOperationException', + 'errorMessage': 'There was an error' } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 400, - "AwsException": "TestOperationException", - "AwsExceptionMessage": "There was an error" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 400, + 'AwsException': 'TestOperationException', + 'AwsExceptionMessage': 'There was an error' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalAwsException": "TestOperationException", - "FinalAwsExceptionMessage": "There was an error", - "FinalHttpStatusCode": 400 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalAwsException': 'TestOperationException', + 'FinalAwsExceptionMessage': 'There was an error', + 'FinalHttpStatusCode': 400 } ] }, { - "description": "Tests a single client API call with retries", - "apiCalls": [ + 'description': 'Tests a single client API call with retries', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 503, - "responseHeaders": {}, - "errorCode": "ServiceUnavailable", - "errorMessage": "Service is unavailable" + 'httpStatus': 503, + 'responseHeaders': {}, + 'errorCode': 'ServiceUnavailable', + 'errorMessage': 'Service is unavailable' }, { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 503, - "AwsException": "ServiceUnavailable", - "AwsExceptionMessage": "Service is unavailable" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 503, + 'AwsException': 'ServiceUnavailable', + 'AwsExceptionMessage': 'Service is unavailable' }, { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 2, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 2, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests a single client API call with non-retryable SDK exception", - "apiCalls": [ + 'description': 'Tests a single client API call with non-retryable SDK exception', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "sdkException": { - "isRetryable": false, - "message": "Unexpected exception was thrown" + 'sdkException': { + 'isRetryable': false, + 'message': 'Unexpected exception was thrown' } } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SdkException": "ANY_STR", - "SdkExceptionMessage": "Unexpected exception was thrown" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SdkException': 'ANY_STR', + 'SdkExceptionMessage': 'Unexpected exception was thrown' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalSdkException": "ANY_STR", - "FinalSdkExceptionMessage": "Unexpected exception was thrown" + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalSdkException': 'ANY_STR', + 'FinalSdkExceptionMessage': 'Unexpected exception was thrown' } ] }, { - "description": "Tests a single client API call with a retryable SDK exception", - "apiCalls": [ + 'description': 'Tests a single client API call with a retryable SDK exception', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "sdkException": { - "isRetryable": true, - "message": "Retryable exception was thrown" + 'sdkException': { + 'isRetryable': true, + 'message': 'Retryable exception was thrown' } }, { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SdkException": "ANY_STR", - "SdkExceptionMessage": "Retryable exception was thrown" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SdkException': 'ANY_STR', + 'SdkExceptionMessage': 'Retryable exception was thrown' }, { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 2, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 2, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests enabling using the shared config file", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": {}, - "sharedConfigFile": { - "csm_enabled": "true" + 'description': 'Tests enabling using the shared config file', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': {}, + 'sharedConfigFile': { + 'csm_enabled': 'true' } }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests explicitly disabling with environment variables", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "false" + 'description': 'Tests explicitly disabling with environment variables', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'false' }, - "sharedConfigFile": {} + 'sharedConfigFile': {} }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [] + 'expectedMonitoringEvents': [] }, { - "description": "Tests explicitly disabling with shared config file", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": {}, - "sharedConfigFile": { - "csm_enabled": "false" + 'description': 'Tests explicitly disabling with shared config file', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': {}, + 'sharedConfigFile': { + 'csm_enabled': 'false' } }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [] + 'expectedMonitoringEvents': [] }, { - "description": "Tests overriding disables in shared config file with environment variables", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true" + 'description': 'Tests overriding disables in shared config file with environment variables', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true' }, - "sharedConfigFile": { - "csm_enabled": "false" + 'sharedConfigFile': { + 'csm_enabled': 'false' } }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests overriding enables in shared config file with environment variables", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "false" + 'description': 'Tests overriding enables in shared config file with environment variables', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'false' }, - "sharedConfigFile": { - "csm_enabled": "true" + 'sharedConfigFile': { + 'csm_enabled': 'true' } }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [] + 'expectedMonitoringEvents': [] }, { - "description": "Tests setting the client id with environment variables", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true", - "AWS_CSM_CLIENT_ID": "from-env" + 'description': 'Tests setting the client id with environment variables', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true', + 'AWS_CSM_CLIENT_ID': 'from-env' }, - "sharedConfigFile": {} + 'sharedConfigFile': {} }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "from-env", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': 'from-env', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "from-env", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': 'from-env', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests setting the client id with shared config file", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true" + 'description': 'Tests setting the client id with shared config file', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true' }, - "sharedConfigFile": { - "csm_client_id": "from-config" + 'sharedConfigFile': { + 'csm_client_id': 'from-config' } }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "from-config", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': 'from-config', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "from-config", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': 'from-config', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests setting the client id with environment variables overrides the client id from the shared config file", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true", - "AWS_CSM_CLIENT_ID": "from-env" + 'description': 'Tests setting the client id with environment variables overrides the client id from the shared config file', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true', + 'AWS_CSM_CLIENT_ID': 'from-env' }, - "sharedConfigFile": { - "csm_client_id": "from-config" + 'sharedConfigFile': { + 'csm_client_id': 'from-config' } }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "from-env", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': 'from-env', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "from-env", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': 'from-env', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Tests a single client API call using a session token", - "configuration": { - "accessKey": "myaccesskey", - "sessionToken": "mysessiontoken", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true" + 'description': 'Tests a single client API call using a session token', + 'configuration': { + 'accessKey': 'myaccesskey', + 'sessionToken': 'mysessiontoken', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true' }, - "sharedConfigFile": {} + 'sharedConfigFile': {} }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": {} + 'httpStatus': 200, + 'responseHeaders': {} } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SessionToken": "mysessiontoken", - "HttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SessionToken': 'mysessiontoken', + 'HttpStatusCode': 200 }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Test a single client API call with x-amzn-RequestId response header", - "apiCalls": [ + 'description': 'Test a single client API call with x-amzn-RequestId response header', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": { - "x-amzn-RequestId": "request-id" + 'httpStatus': 200, + 'responseHeaders': { + 'x-amzn-RequestId': 'request-id' } } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200, - "XAmznRequestId": "request-id" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200, + 'XAmznRequestId': 'request-id' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Test a single client API call with x-amz-request-id response header", - "apiCalls": [ + 'description': 'Test a single client API call with x-amz-request-id response header', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": { - "x-amz-request-id": "request-id" + 'httpStatus': 200, + 'responseHeaders': { + 'x-amz-request-id': 'request-id' } } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200, - "XAmzRequestId": "request-id" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200, + 'XAmzRequestId': 'request-id' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Test a single client API call with x-amz-id-2 response header", - "apiCalls": [ + 'description': 'Test a single client API call with x-amz-id-2 response header', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 200, - "responseHeaders": { - "x-amz-id-2": "request-id" + 'httpStatus': 200, + 'responseHeaders': { + 'x-amz-id-2': 'request-id' } } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 200, - "XAmzId2": "request-id" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 200, + 'XAmzId2': 'request-id' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 1, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalHttpStatusCode": 200 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 1, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalHttpStatusCode': 200 } ] }, { - "description": "Test max retries from AWS exception", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true" + 'description': 'Test max retries from AWS exception', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true' }, - "sharedConfigFile": {}, - "maxRetries": 1 + 'sharedConfigFile': {}, + 'maxRetries': 1 }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "httpStatus": 503, - "responseHeaders": {}, - "errorCode": "ServiceUnavailable", - "errorMessage": "Service is unavailable" + 'httpStatus': 503, + 'responseHeaders': {}, + 'errorCode': 'ServiceUnavailable', + 'errorMessage': 'Service is unavailable' }, { - "httpStatus": 503, - "responseHeaders": {}, - "errorCode": "ServiceUnavailable", - "errorMessage": "Service is unavailable" + 'httpStatus': 503, + 'responseHeaders': {}, + 'errorCode': 'ServiceUnavailable', + 'errorMessage': 'Service is unavailable' } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 503, - "AwsException": "ServiceUnavailable", - "AwsExceptionMessage": "Service is unavailable" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 503, + 'AwsException': 'ServiceUnavailable', + 'AwsExceptionMessage': 'Service is unavailable' }, { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "HttpStatusCode": 503, - "AwsException": "ServiceUnavailable", - "AwsExceptionMessage": "Service is unavailable" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'HttpStatusCode': 503, + 'AwsException': 'ServiceUnavailable', + 'AwsExceptionMessage': 'Service is unavailable' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 2, - "MaxRetriesExceeded": 1, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalAwsException": "ServiceUnavailable", - "FinalAwsExceptionMessage": "Service is unavailable", - "FinalHttpStatusCode": 503 + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 2, + 'MaxRetriesExceeded': 1, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalAwsException': 'ServiceUnavailable', + 'FinalAwsExceptionMessage': 'Service is unavailable', + 'FinalHttpStatusCode': 503 } ] }, { - "description": "Test max retries from SDK exception", - "configuration": { - "accessKey": "myaccesskey", - "region": "us-west-2", - "environmentVariables": { - "AWS_CSM_ENABLED": "true" + 'description': 'Test max retries from SDK exception', + 'configuration': { + 'accessKey': 'myaccesskey', + 'region': 'us-west-2', + 'environmentVariables': { + 'AWS_CSM_ENABLED': 'true' }, - "sharedConfigFile": {}, - "maxRetries": 1 + 'sharedConfigFile': {}, + 'maxRetries': 1 }, - "apiCalls": [ + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "sdkException": { - "isRetryable": true, - "message": "Retryable exception was thrown" + 'sdkException': { + 'isRetryable': true, + 'message': 'Retryable exception was thrown' } }, { - "sdkException": { - "isRetryable": true, - "message": "Retryable exception was thrown" + 'sdkException': { + 'isRetryable': true, + 'message': 'Retryable exception was thrown' } } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SdkException": "ANY_STR", - "SdkExceptionMessage": "Retryable exception was thrown" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SdkException': 'ANY_STR', + 'SdkExceptionMessage': 'Retryable exception was thrown' }, { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SdkException": "ANY_STR", - "SdkExceptionMessage": "Retryable exception was thrown" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SdkException': 'ANY_STR', + 'SdkExceptionMessage': 'Retryable exception was thrown' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 2, - "MaxRetriesExceeded": 1, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalSdkException": "ANY_STR", - "FinalSdkExceptionMessage": "Retryable exception was thrown" + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 2, + 'MaxRetriesExceeded': 1, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalSdkException': 'ANY_STR', + 'FinalSdkExceptionMessage': 'Retryable exception was thrown' } ] }, { - "description": "Test final uses the exception from final attempt", - "apiCalls": [ + 'description': 'Test final uses the exception from final attempt', + 'apiCalls': [ { - "serviceId": "CSM Test", - "operationName": "TestOperation", - "params": {}, - "attemptResponses": [ + 'serviceId': 'CSM Test', + 'operationName': 'TestOperation', + 'params': {}, + 'attemptResponses': [ { - "sdkException": { - "isRetryable": true, - "message": "First retryable exception" + 'sdkException': { + 'isRetryable': true, + 'message': 'First retryable exception' } }, { - "sdkException": { - "isRetryable": false, - "message": "Second un-retryable exception" + 'sdkException': { + 'isRetryable': false, + 'message': 'Second un-retryable exception' } } ] } ], - "expectedMonitoringEvents": [ + 'expectedMonitoringEvents': [ { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SdkException": "ANY_STR", - "SdkExceptionMessage": "First retryable exception" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SdkException': 'ANY_STR', + 'SdkExceptionMessage': 'First retryable exception' }, { - "Version": 1, - "Type": "ApiCallAttempt", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "AttemptLatency": "ANY_INT", - "Fqdn": "csmtest.us-west-2.amazonaws.com", - "Region": "us-west-2", - "UserAgent": "ANY_STR", - "AccessKey": "myaccesskey", - "SdkException": "ANY_STR", - "SdkExceptionMessage": "Second un-retryable exception" + 'Version': 1, + 'Type': 'ApiCallAttempt', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'AttemptLatency': 'ANY_INT', + 'Fqdn': 'csmtest.us-west-2.amazonaws.com', + 'Region': 'us-west-2', + 'UserAgent': 'ANY_STR', + 'AccessKey': 'myaccesskey', + 'SdkException': 'ANY_STR', + 'SdkExceptionMessage': 'Second un-retryable exception' }, { - "Version": 1, - "Type": "ApiCall", - "Service": "CSM Test", - "Api": "TestOperation", - "ClientId": "", - "Timestamp": "ANY_INT", - "Latency": "ANY_INT", - "AttemptCount": 2, - "MaxRetriesExceeded": 0, - "UserAgent": "ANY_STR", - "Region": "us-west-2", - "FinalSdkException": "ANY_STR", - "FinalSdkExceptionMessage": "Second un-retryable exception" + 'Version': 1, + 'Type': 'ApiCall', + 'Service': 'CSM Test', + 'Api': 'TestOperation', + 'ClientId': '', + 'Timestamp': 'ANY_INT', + 'Latency': 'ANY_INT', + 'AttemptCount': 2, + 'MaxRetriesExceeded': 0, + 'UserAgent': 'ANY_STR', + 'Region': 'us-west-2', + 'FinalSdkException': 'ANY_STR', + 'FinalSdkExceptionMessage': 'Second un-retryable exception' } ] } ] -} +}; diff --git a/test/publisher/functional_test/runner.spec.js b/test/publisher/functional_test/runner.spec.js index 1e331e44fe..97205a12dc 100644 --- a/test/publisher/functional_test/runner.spec.js +++ b/test/publisher/functional_test/runner.spec.js @@ -50,7 +50,7 @@ describe('run functional test', () => { const str = data.toString('utf8'); const parsed = str.trim().split('\n').map(JSON.parse); monitoringEvents = monitoringEvents.concat(parsed); - }) + }); //start call according to test cases for (const apiCall of scenario.apiCalls) { @@ -62,7 +62,7 @@ describe('run functional test', () => { if (scenarioConfiguration.sessionToken) { client.config.credentials.sessionToken = scenarioConfiguration.sessionToken; } - if(scenarioConfiguration.maxRetries) { + if (scenarioConfiguration.maxRetries) { client.config.maxRetries = scenarioConfiguration.maxRetries; } const operation = apiCall.operationName[0].toLowerCase() + apiCall.operationName.substring(1); @@ -75,17 +75,17 @@ describe('run functional test', () => { //close agent and then validate the datagram echo-ed back from agent await agentFinished(fakeAgent); expect(validateEvents(monitoringEvents, scenario.expectedMonitoringEvents)).to.eql(true); - }) + }); } -}) +}); function getConstructParam(configurations) { let constructParams = {}; - if(configurations.userAgent) constructParams.customUserAgent = configurations.userAgent; - if(configurations.region) constructParams.region = configurations.region; - if(configurations.paramValidation === false) constructParams.paramValidation = configurations.paramValidation; - if(configurations.clientSideMonitoring) constructParams.clientSideMonitoring = configurations.clientSideMonitoring; + if (configurations.userAgent) constructParams.customUserAgent = configurations.userAgent; + if (configurations.region) constructParams.region = configurations.region; + if (configurations.paramValidation === false) constructParams.paramValidation = configurations.paramValidation; + if (configurations.clientSideMonitoring) constructParams.clientSideMonitoring = configurations.clientSideMonitoring; return constructParams; } @@ -103,8 +103,8 @@ function agentStart(port) { } else { reject(new Error('agent start error')); } - }) - }) + }); + }); } function agentFinished(agentProcess) { @@ -112,7 +112,7 @@ function agentFinished(agentProcess) { agentProcess.once('message', (m) => { // fake csm agent notifies the echo-ing is done. if (m.recordingDone === true) { - agentProcess.kill(9) + agentProcess.kill(9); } resolve(); }); diff --git a/test/publisher/functional_test/utils/mock_agent.js b/test/publisher/functional_test/utils/mock_agent.js index 2cb523a5ad..0e66ece19e 100644 --- a/test/publisher/functional_test/utils/mock_agent.js +++ b/test/publisher/functional_test/utils/mock_agent.js @@ -18,9 +18,9 @@ server.on('listening', () => { serverStarted: true, port: address.port, }); -}) +}); -//notify the parent process the calls are done and begin the +//notify the parent process the calls are done and begin the //monitoring events validation process.on('message', (m) => { if (m.message === 'Sending Done') { @@ -30,7 +30,7 @@ process.on('message', (m) => { process.send({recordingDone: true}); }, 30); } -}) +}); const args = parseArgs(); @@ -45,6 +45,6 @@ function parseArgs() { } accumulator[kvPair[0]] = kvPair[1]; } - return accumulator + return accumulator; }, {port: defaultPort}); } diff --git a/test/publisher/functional_test/utils/mock_http_client.js b/test/publisher/functional_test/utils/mock_http_client.js index 7b9c0b2970..72124cc86d 100644 --- a/test/publisher/functional_test/utils/mock_http_client.js +++ b/test/publisher/functional_test/utils/mock_http_client.js @@ -14,7 +14,7 @@ function mockDefinedResponses(resps, request) { }); index ++; } - done() + done(); }); //mock aws exceptions var stream = new EventEmitter(); @@ -67,7 +67,7 @@ function mockFailedResponse(resp, request) { body: body, headers: headers, statusCode: resp.httpStatus, - } + }; } function faildResponseBody(protocol, resp) { @@ -85,12 +85,12 @@ function faildResponseBody(protocol, resp) { -` +`; break; case 'json': case 'rest-json': //error code should be set in x-amzn-errortype header - return `{"Message": "${resp.errorMessage}"}` + return `{"Message": "${resp.errorMessage}"}`; default: break; } @@ -98,4 +98,4 @@ function faildResponseBody(protocol, resp) { module.exports = { mockResponses: mockDefinedResponses, -} +}; diff --git a/test/publisher/functional_test/utils/validateEvents.js b/test/publisher/functional_test/utils/validateEvents.js index 17a6d1a739..9751e7e7d2 100644 --- a/test/publisher/functional_test/utils/validateEvents.js +++ b/test/publisher/functional_test/utils/validateEvents.js @@ -1,5 +1,5 @@ function validateEvents(events, expected) { - if(events.length !== expected.length) { + if (events.length !== expected.length) { throw new Error(`Expected ${expected.length} events but received ${events.length}`); }; //since the events may be out of order, for each @@ -7,7 +7,7 @@ function validateEvents(events, expected) { //find the correspond one. expected = expected.slice(0);//shallow copy of expected events array for (const event of events) { - let equaledIndex = 0 + let equaledIndex = 0; while (equaledIndex < expected.length) { if (validateEvent(event, expected[equaledIndex])) break; equaledIndex ++; @@ -15,16 +15,16 @@ function validateEvents(events, expected) { if (equaledIndex === expected.length) { throw new Error(`Cannot validate the event: ${JSON.stringify(event)}`); } else { - expected = expected.slice(0, equaledIndex).concat(expected.slice(equaledIndex + 1)) + expected = expected.slice(0, equaledIndex).concat(expected.slice(equaledIndex + 1)); //remove found correspond one from expected event array } } - if (expected.length === 0) return true + if (expected.length === 0) return true; return false; } function validateEvent(event, expected) { - if (event.Type === 'ApiCallAttempt') + if (event.Type === 'ApiCallAttempt') return validateApiCallAttemptEvent(event, expected); if (event.Type === 'ApiCall') return validateApiCallEvent(event, expected); @@ -41,7 +41,7 @@ function validateApiCallEvent(event, expected) { 'AttemptCount', 'Latency', 'MaxRetriesExceeded', 'ApiCallTimeout', 'FinalAwsException', 'FinalAwsExceptionMessage', 'FinalSdkException', 'FinalSdkExceptionMessage', 'FinalHttpStatusCode' - ] + ]; for (const keyToValidate of keysToValidate) { if (!validateEntry(event, expected, keyToValidate)) return false; } @@ -56,9 +56,9 @@ function validateApiCallAttemptEvent(event, expected) { 'Service', 'Api', 'ClientId', 'Version', 'Timestamp', 'Region', 'UserAgent', //api call attempt monitoring event entries 'Fqdn', 'AttemptLatency', 'SessionToken', 'AccessKey', 'HttpStatusCode', - 'AwsException', 'AwsExceptionMessage', 'SdkException', 'SdkExceptionMessage', 'XAmznRequestId', + 'AwsException', 'AwsExceptionMessage', 'SdkException', 'SdkExceptionMessage', 'XAmznRequestId', 'XAmzRequestId', 'XAmzId2' - ] + ]; for (const keyToValidate of keysToValidate) { if (!validateEntry(event, expected, keyToValidate)) return false; } @@ -69,14 +69,14 @@ function validateEntry(event, expected, key) { // additional entry will not be validated if (typeof expected[key] === 'undefined') return true; //validationg the type of event - if(isANY(expected[key])) { + if (isANY(expected[key])) { return validateANY(event[key], expected[key]); } - return event[key] === expected[key] + return event[key] === expected[key]; } function isANY(value) { - return value && value.indexOf && value.indexOf('ANY_') === 0 + return value && value.indexOf && value.indexOf('ANY_') === 0; } function validateANY(origin, expect) { @@ -87,7 +87,7 @@ function validateANY(origin, expect) { } else if (expect === 'ANY_INT' && Number.isInteger(origin)) { return true; } - return false + return false; } module.exports.validateEvents = validateEvents; diff --git a/test/rds/signer.spec.js b/test/rds/signer.spec.js index e186a1a20f..97611102df 100644 --- a/test/rds/signer.spec.js +++ b/test/rds/signer.spec.js @@ -1,13 +1,13 @@ var helpers = require('../helpers'); var AWS = helpers.AWS; - + describe('AWS.RDS.Signer', function() { describe('constructor', function() { it('can be instantiated without parameters', function() { var signer = new AWS.RDS.Signer(); expect(signer instanceof AWS.RDS.Signer).to.equal(true); }); - + it('can be instantiated with parameters', function() { var signer = new AWS.RDS.Signer({ hostname: 'db.us-east-1.amazonaws.com', @@ -16,7 +16,7 @@ describe('AWS.RDS.Signer', function() { expect(signer instanceof AWS.RDS.Signer).to.equal(true); }); }); - + describe('getAuthToken', function() { var expectedToken = 'db.us-east-1.amazonaws.com:8000/?Action=connect&DBUser=test&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=akid%2F19700101%2Fus-east-1%2Frds-db%2Faws4_request&X-Amz-Date=19700101T000000Z&X-Amz-Expires=900&X-Amz-Signature=6f2b4daa29668c1c264d7af7927d9d2a706768e35d92d76b461aedbaca14b6ad&X-Amz-SignedHeaders=host'; var testOptions = { @@ -43,7 +43,7 @@ describe('AWS.RDS.Signer', function() { expect(didError).to.equal(true); }); }); - + it('will not error if all fields are accessible with credentials', function() { var didError = false; try { @@ -52,9 +52,9 @@ describe('AWS.RDS.Signer', function() { didError = true; } expect(didError).to.equal(false); - expect(typeof token).to.equal('string'); + expect(typeof token).to.equal('string'); }); - + it('allows passing credentials', function() { var didError = false; var options = AWS.util.merge(testOptions, { @@ -71,7 +71,7 @@ describe('AWS.RDS.Signer', function() { expect(didError).to.equal(false); expect(token).to.equal(expectedToken); }); - + it('will use options passed into the constructor when needed', function() { var didError = false; var signer = new AWS.RDS.Signer({ @@ -94,7 +94,7 @@ describe('AWS.RDS.Signer', function() { expect(didError).to.equal(false); expect(token).to.equal(expectedToken); }); - + it('does not require options if they are all passed to constructor', function() { var didError = false; var signer = new AWS.RDS.Signer({ @@ -116,9 +116,9 @@ describe('AWS.RDS.Signer', function() { expect(didError).to.equal(false); expect(token).to.equal(expectedToken); }); - + describe('can asynchronously', function() { - + it('handle errors', function(done) { var signer = new AWS.RDS.Signer({ hostname: 'db.us-east-1.amazonaws.com', @@ -135,7 +135,7 @@ describe('AWS.RDS.Signer', function() { done(); }); }); - + it('generate a token', function(done) { var signer = new AWS.RDS.Signer({ hostname: 'db.us-east-1.amazonaws.com', @@ -153,7 +153,7 @@ describe('AWS.RDS.Signer', function() { done(); }); }); - + it('generate a token without options (when specified in constructor)', function(done) { var signer = new AWS.RDS.Signer({ hostname: 'db.us-east-1.amazonaws.com', @@ -172,6 +172,6 @@ describe('AWS.RDS.Signer', function() { }); }); }); - + }); -}); \ No newline at end of file +}); diff --git a/test/react-native/add-content-type.spec.js b/test/react-native/add-content-type.spec.js index ed42f7ba97..7e96d740f0 100644 --- a/test/react-native/add-content-type.spec.js +++ b/test/react-native/add-content-type.spec.js @@ -40,4 +40,4 @@ describe('React Native', function() { expect(typeof req.httpRequest.headers['Content-Type']).to.eql('undefined'); }); }); -}); \ No newline at end of file +}); diff --git a/test/react-native/util.spec.js b/test/react-native/util.spec.js index 3efe134a17..341b24a126 100644 --- a/test/react-native/util.spec.js +++ b/test/react-native/util.spec.js @@ -11,4 +11,4 @@ describe('React Native', function() { expect(AWS.util.environment).to.eql('js-react-native'); }); }); -}); \ No newline at end of file +}); diff --git a/test/request.spec.js b/test/request.spec.js index 926caf46b3..3cbf33b235 100644 --- a/test/request.spec.js +++ b/test/request.spec.js @@ -35,7 +35,7 @@ describe('AWS.Request', function() { return service.makeRequest('mockMethod', function() { throw new Error('error'); }); - }).to["throw"]('error'); + }).to['throw']('error'); }); ref = ['error', 'success', 'complete']; for (i = 0, len = ref.length; i < len; i++) { @@ -49,7 +49,7 @@ describe('AWS.Request', function() { throw new Error('error'); }); return req.send(); - }).to["throw"]('error'); + }).to['throw']('error'); }); } @@ -66,7 +66,7 @@ describe('AWS.Request', function() { return req.send(function(e) { return err = e; }); - }).not.to["throw"]('error'); + }).not.to['throw']('error'); expect(err.message).to.equal('error'); }); @@ -679,13 +679,13 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.be["null"]; + expect(error).to.be['null']; }); s.on('data', function(c) { return data += c.toString(); }); return s.on('end', function() { - expect(error).to.be["null"]; + expect(error).to.be['null']; expect(data).to.equal('FOOBARBAZQUX'); done(); }); @@ -705,13 +705,13 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.be["null"]; + expect(error).to.be['null']; }); s.on('data', function(c) { data += c.toString(); }); s.on('end', function() { - expect(error).to.be["null"]; + expect(error).to.be['null']; expect(data).to.equal('FOOBARBAZQUX'); done(); }); @@ -733,11 +733,11 @@ describe('AWS.Request', function() { return data += c.toString(); }); s.on('end', function(a) { - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; }); return s.on('error', function(e) { error = e; - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; expect(error.code).to.equal('StreamContentLengthMismatch'); expect(data).to.equal('FOOBARBAZQUX'); done(); @@ -758,13 +758,13 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; }); s.on('data', function(c) { return data += c.toString(); }); return s.on('end', function() { - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; done(); }); }); @@ -778,10 +778,10 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.be["null"]; + expect(error).to.be['null']; }); s.on('end', function() { - expect(error).to.be["null"]; + expect(error).to.be['null']; expect(data).to.equal('FOOBARBAZQUX'); done(); }); @@ -815,10 +815,10 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.be["null"]; + expect(error).to.be['null']; }); s.on('end', function() { - expect(error).to.be["null"]; + expect(error).to.be['null']; expect(data).to.equal('FOOBARBAZQUX'); done(); }); @@ -852,13 +852,13 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; expect(error.code).to.equal('StreamContentLengthMismatch'); expect(data).to.equal('FOOBARBAZQUX'); done(); }); s.on('end', function() { - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; }); return s.on('readable', function() { var chunk, e; @@ -890,10 +890,10 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; }); s.on('end', function() { - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; done(); }); return s.on('readable', function() { @@ -921,13 +921,13 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; expect(error.statusCode).to.equal(404); expect(data).to.equal(''); done(); }); s.on('end', function() { - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; }); return s.on('data', function(c) { return data += c.toString(); @@ -947,13 +947,13 @@ describe('AWS.Request', function() { s = request.createReadStream(); s.on('error', function(e) { error = e; - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; expect(error.statusCode).to.equal(404); expect(data).to.equal(''); done(); }); s.on('end', function() { - expect(error).to.not.be["null"]; + expect(error).to.not.be['null']; }); return s.on('readable', function() { var chunk, e; @@ -994,7 +994,7 @@ describe('AWS.Request', function() { return data += c.toString(); }); return request.on('complete', function() { - expect(error).to.be["null"]; + expect(error).to.be['null']; expect(data).to.equal('FOOBARBAZQUX'); done(); }); diff --git a/test/resource_waiter.spec.js b/test/resource_waiter.spec.js index 72c042f8e8..fd089e86b2 100644 --- a/test/resource_waiter.spec.js +++ b/test/resource_waiter.spec.js @@ -362,21 +362,21 @@ describe('AWS.ResourceWaiter', function() { waiter.config.acceptors = [ { expected: 1, - matcher: "pathAny", - state: "failure", - argument: "length(baz)" + matcher: 'pathAny', + state: 'failure', + argument: 'length(baz)' }, { expected: 1, - matcher: "pathAll", - state: "retry", - argument: "length(baz)" + matcher: 'pathAll', + state: 'retry', + argument: 'length(baz)' }, { expected: true, - matcher: "path", - state: "success", - argument: "length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`" + matcher: 'path', + state: 'success', + argument: 'length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`' } ]; waiter.wait(function (err, data) { diff --git a/test/response.spec.js b/test/response.spec.js index 0042517833..e681762878 100644 --- a/test/response.spec.js +++ b/test/response.spec.js @@ -95,7 +95,7 @@ service.api.pagination = {}; return expect(function() { return response.nextPage(); - }).to["throw"]('No pagination configuration for op'); + }).to['throw']('No pagination configuration for op'); }); it('returns null if there are no more pages', function() { fill(null, {}, true); @@ -114,7 +114,7 @@ fill(new Error('error!'), null, true); return expect(function() { return response.nextPage(); - }).to["throw"]('error!'); + }).to['throw']('error!'); }); it('sends the request if passed with a callback', function(done) { helpers.mockHttpResponse(200, {}, ['']); diff --git a/test/s3/managed_upload.spec.js b/test/s3/managed_upload.spec.js index 756651d52b..daa03e02b7 100644 --- a/test/s3/managed_upload.spec.js +++ b/test/s3/managed_upload.spec.js @@ -105,12 +105,12 @@ }); return expect(function() { return upload.send(); - }).to["throw"]('ERROR'); + }).to['throw']('ERROR'); }); it('fails if Body is not passed', function() { return expect(function() { return send(); - }).to["throw"]('params.Body is required'); + }).to['throw']('params.Body is required'); }); it('fails if Body is unknown type', function() { send({ @@ -135,7 +135,7 @@ it('uses a default service object if none provided', function() { return expect(function() { return new AWS.S3.ManagedUpload(); - }).to["throw"]('params.Body is required'); + }).to['throw']('params.Body is required'); }); it('uploads a single part if size is less than min multipart size', function(done) { var reqs; @@ -382,7 +382,7 @@ return new AWS.S3.ManagedUpload({ partSize: 5 }); - }).to["throw"]('partSize must be greater than 10'); + }).to['throw']('partSize must be greater than 10'); }); it('aborts if uploadPart fails', function(done) { var reqs; @@ -694,7 +694,7 @@ upload.doneParts++; } return uploadPartSpy.origMethod.apply(uploadPartSpy.object, arguments); - }) + }); send({}, function(err, data) { expect(err).not.to.exist; expect(helpers.operationsForRequests(reqs)).to.eql([ @@ -704,7 +704,7 @@ 's3.completeMultipartUpload' ]); done(); - }) + }); }); describe('Location', function() { @@ -1048,7 +1048,7 @@ service: s3, params: params }); - return upload.promise().then(thenFunction)["catch"](catchFunction).then(function() { + return upload.promise().then(thenFunction)['catch'](catchFunction).then(function() { expect(err).not.to.exist; expect(data.ETag).to.equal('ETAG'); expect(data.Location).to.equal('https://bucket.s3.mock-region.amazonaws.com/key'); @@ -1094,7 +1094,7 @@ service: s3, params: params }); - return upload.promise().then(thenFunction)["catch"](catchFunction).then(function() { + return upload.promise().then(thenFunction)['catch'](catchFunction).then(function() { expect(helpers.operationsForRequests(reqs)).to.eql(['s3.createMultipartUpload', 's3.uploadPart', 's3.uploadPart', 's3.uploadPart', 's3.uploadPart', 's3.completeMultipartUpload']); expect(err).not.to.exist; expect(data.ETag).to.equal('FINAL_ETAG'); @@ -1145,7 +1145,7 @@ service: s3, params: params }); - return upload.promise().then(thenFunction)["catch"](catchFunction).then(function() { + return upload.promise().then(thenFunction)['catch'](catchFunction).then(function() { expect(data).not.to.exist; return expect(err.message).to.equal('ERROR'); }); diff --git a/test/s3/virtual-host.fixture.js b/test/s3/virtual-host.fixture.js index a8cf2be20b..46a030b030 100644 --- a/test/s3/virtual-host.fixture.js +++ b/test/s3/virtual-host.fixture.js @@ -155,4 +155,4 @@ var testCases = [ module.exports = { testCases: testCases -}; \ No newline at end of file +}; diff --git a/test/sequential_executor.spec.js b/test/sequential_executor.spec.js index 8528cb5f97..329e408706 100644 --- a/test/sequential_executor.spec.js +++ b/test/sequential_executor.spec.js @@ -31,7 +31,7 @@ this.emitter.emit('event1'); return expect(list).to.eql([3, 2, 1, 4]); }); - }) + }); describe('addListeners', function() { @@ -91,7 +91,7 @@ this.emitter.addNamedListener('CONSTNAME', 'eventName', spy); expect(this.emitter.CONSTNAME).to.equal(spy); this.emitter.emit('eventName', ['argument']); - return expect(spy.calls[0]["arguments"]).to.eql(['argument']); + return expect(spy.calls[0]['arguments']).to.eql(['argument']); }); it('is chainable', function() { @@ -121,7 +121,7 @@ }, addToHead); this.emitter.emit('event', []); return expect(list).to.eql([5, 3, 2, 1, 4]); - }) + }); }); describe('addNamedListeners', function() { @@ -144,8 +144,8 @@ expect(this.emitter.CONST2).to.equal(spy2); this.emitter.emit('event1', ['arg1']); this.emitter.emit('event2', ['arg2']); - expect(spy1.calls[0]["arguments"]).to.eql(['arg1']); - return expect(spy2.calls[0]["arguments"]).to.eql(['arg2']); + expect(spy1.calls[0]['arguments']).to.eql(['arg1']); + return expect(spy2.calls[0]['arguments']).to.eql(['arg2']); }); }); @@ -209,4 +209,4 @@ }); }); -}).call(this); \ No newline at end of file +}).call(this); diff --git a/test/service.spec.js b/test/service.spec.js index 50f7b995ab..2361e6be48 100644 --- a/test/service.spec.js +++ b/test/service.spec.js @@ -51,11 +51,11 @@ AWS.config.update({ correctClockSkew: true, systemClockOffset: 120000 - }) + }); s3 = new AWS.S3; expect(s3.config.systemClockOffset).to.equal(120000); return expect(s3.config.correctClockSkew).to.equal(true); - }) + }); it('merges service-specific configuration from global config', function() { var s3; @@ -122,64 +122,64 @@ it('tries to construct service with latest API version', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-2001-01-01"; + errmsg = 'Could not find API configuration custom-2001-01-01'; return expect(function() { return new CustomService(); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('tries to construct service with exact API version match', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-1999-05-05"; + errmsg = 'Could not find API configuration custom-1999-05-05'; return expect(function() { return new CustomService({ apiVersion: '1999-05-05' }); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('skips any API versions with a * and uses next (future) service', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['1998-01-01', '1999-05-05*', '2001-01-01']); - errmsg = "Could not find API configuration custom-2001-01-01"; + errmsg = 'Could not find API configuration custom-2001-01-01'; return expect(function() { return new CustomService({ apiVersion: '2000-01-01' }); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('skips multiple API versions with a * and uses next (future) service', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['1998-01-01', '1999-05-05*', '1999-07-07*', '2001-01-01']); - errmsg = "Could not find API configuration custom-2001-01-01"; + errmsg = 'Could not find API configuration custom-2001-01-01'; return expect(function() { return new CustomService({ apiVersion: '1999-05-05' }); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('tries to construct service with fuzzy API version match', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-1999-05-05"; + errmsg = 'Could not find API configuration custom-1999-05-05'; return expect(function() { return new CustomService({ apiVersion: '2000-01-01' }); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('uses global apiVersion value when constructing versioned services', function() { var CustomService, errmsg; AWS.config.apiVersion = '2002-03-04'; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-2001-01-01"; + errmsg = 'Could not find API configuration custom-2001-01-01'; expect(function() { return new CustomService; - }).to["throw"](errmsg); + }).to['throw'](errmsg); return AWS.config.apiVersion = null; }); @@ -189,10 +189,10 @@ custom: '2002-03-04' }; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-2001-01-01"; + errmsg = 'Could not find API configuration custom-2001-01-01'; expect(function() { return new CustomService; - }).to["throw"](errmsg); + }).to['throw'](errmsg); return AWS.config.apiVersions = {}; }); @@ -203,10 +203,10 @@ }; AWS.config.apiVersion = '2002-03-04'; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-1999-05-05"; + errmsg = 'Could not find API configuration custom-1999-05-05'; expect(function() { return new CustomService; - }).to["throw"](errmsg); + }).to['throw'](errmsg); AWS.config.apiVersion = null; return AWS.config.apiVersions = {}; }); @@ -214,23 +214,23 @@ it('tries to construct service with fuzzy API version match', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find API configuration custom-1999-05-05"; + errmsg = 'Could not find API configuration custom-1999-05-05'; return expect(function() { return new CustomService({ apiVersion: '2000-01-01' }); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('fails if apiVersion matches nothing', function() { var CustomService, errmsg; CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05']); - errmsg = "Could not find custom API to satisfy version constraint `1998-01-01'"; + errmsg = 'Could not find custom API to satisfy version constraint `1998-01-01\''; return expect(function() { return new CustomService({ apiVersion: '1998-01-01' }); - }).to["throw"](errmsg); + }).to['throw'](errmsg); }); it('allows construction of services from one-off apiConfig properties', function() { @@ -280,7 +280,7 @@ return new ctor({ apiVersion: v }); - }).not.to["throw"](); + }).not.to['throw'](); }); })(ctor, serviceIdentifier, version)); } @@ -290,7 +290,7 @@ return results; }); }); - + describe('setEndpoint', function() { var FooService; FooService = null; @@ -798,7 +798,7 @@ return expect(didError).to.equal(true); }); }); - describe('Service clock sync functions', function() { + describe('Service clock sync functions', function() { beforeEach(function(done) { AWS.config.update({ systemClockOffset: 0 @@ -812,21 +812,21 @@ expect(mockService.isClockSkewed(now)).to.equal(true); helpers.spyOn(mockService, 'getSkewCorrectedDate').andReturn(new Date(now + 29900)); expect(mockService.isClockSkewed(now)).to.equal(false); - }); + }); it('should apply the clock offset to service config', function() { var mockService = new MockService(); expect(mockService.config.systemClockOffset).to.equal(0); mockService.applyClockOffset(new Date().getTime() + 30000); - var offset = mockService.config.systemClockOffset + var offset = mockService.config.systemClockOffset; expect(offset > 29900 && offset < 30100).to.equal(true); }); it('should get skew-corrected date for each service', function() { var mockService = new MockService(); mockService.config.update({ systemClockOffset: 30000 - }) + }); var now = new Date().getTime(); - var serviceTime = mockService.getSkewCorrectedDate().getTime() + var serviceTime = mockService.getSkewCorrectedDate().getTime(); expect(now + 29900 < serviceTime && serviceTime < now + 30100).to.equal(true); }); it('should update each client\'s systemClockOffset respectively', function() { @@ -843,16 +843,16 @@ date: serverDate.toString() }, ''); mockService2.makeRequest().send(); - var offset = mockService1.config.systemClockOffset + var offset = mockService1.config.systemClockOffset; expect(59900 < offset && 60100 > offset).to.equal(true); - offset = mockService2.config.systemClockOffset + offset = mockService2.config.systemClockOffset; expect(119900 < offset && 120100 > offset).to.equal(true); }); }); describe('Service monitoring events emitter', function() { it('should emit events on specific service client', function() { - helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); + helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); var client = new MockService(); var client2 = new MockService(); var callNum = 0; var attemptNum = 0; @@ -885,7 +885,7 @@ attemptNum ++; expect(event.Type).to.equal('ApiCallAttempt'); }); - helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); + helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); var client = new MockService(); client.makeRequest('operationName', function(err, data) {}); expect(callNum).to.equal(1); @@ -903,16 +903,16 @@ attemptNum ++; expect(event.Type).to.equal('ApiCallAttempt'); }); - helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); + helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); var client = new MockService(); client.makeRequest('operationName', function(err, data) {}); expect(callNum).to.equal(1); expect(attemptNum).to.equal(1); - }) - }) + }); + }); it('should emit api call events when request succeeds', function(done) { - helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); + helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); var client = new MockService({}); client.on('apiCall', function apiCallListener(event) { expect(event.Type).to.equal('ApiCall'); @@ -930,7 +930,7 @@ }); it('should emit api call events when request fails for aws exception', function(done) { - helpers.mockHttpResponse(500, {}, ['ServiceUnavailableException']); + helpers.mockHttpResponse(500, {}, ['ServiceUnavailableException']); var client = new MockService({maxRetries: 0}); client.on('apiCall', function apiCallListener(event) { expect(event.Type).to.equal('ApiCall'); @@ -952,7 +952,7 @@ helpers.mockHttpResponse(200, { 'x-amz-request-id': 'request-id', 'x-amzn-requestid': 'n-request-id' - }, ['FOO', 'BAR']); + }, ['FOO', 'BAR']); var client = new MockService(); client.on('apiCallAttempt', function apiCallListener(event) { expect(event.Type).to.equal('ApiCallAttempt'); @@ -977,10 +977,10 @@ helpers.mockHttpResponse(200, {}, ['FOO', 'BAR']); var events = []; AWS.Service.prototype.publisher = { - eventHandler: function(event){ - events.push(event) + eventHandler: function(event) { + events.push(event); } - } + }; var client = new MockService({clientSideMonitoring: true}); client.makeRequest('operationName', function(err, data) {}); process.nextTick(function() { diff --git a/test/services/apigateway.spec.js b/test/services/apigateway.spec.js index cadb6848c5..897324af4e 100644 --- a/test/services/apigateway.spec.js +++ b/test/services/apigateway.spec.js @@ -66,15 +66,15 @@ it('converts the body to a string when the exportType is "swagger"', function(done) { var body, swaggerDoc; swaggerDoc = JSON.stringify({ - swagger: "2.0", - host: "foo.amazonaws.com" + swagger: '2.0', + host: 'foo.amazonaws.com' }); body = new Buffer(swaggerDoc); helpers.mockHttpResponse(200, {}, body); return apigateway.getExport({ exportType: 'swagger' }, function(err, data) { - expect(Buffer.isBuffer(data.body)).to.be["false"]; + expect(Buffer.isBuffer(data.body)).to.be['false']; expect(data.body).to.eql(swaggerDoc); return done(); }); @@ -82,17 +82,17 @@ return it('returns the raw payload when the exportType is not "swagger"', function(done) { var body, swaggerDoc; swaggerDoc = JSON.stringify({ - notSwagger: "2.0", - host: "foo.amazonaws.com" + notSwagger: '2.0', + host: 'foo.amazonaws.com' }); body = new Buffer(swaggerDoc); helpers.mockHttpResponse(200, {}, body); return apigateway.getExport({ exportType: 'notSwagger' }, function(err, data) { - expect(Buffer.isBuffer(data.body)).to.be["true"]; + expect(Buffer.isBuffer(data.body)).to.be['true']; if (typeof body.equals === 'function') { - expect(body.equals(data.body)).to.be["true"]; + expect(body.equals(data.body)).to.be['true']; } else { expect(body.toString()).to.equal(data.body.toString()); } diff --git a/test/services/cloudfront.spec.js b/test/services/cloudfront.spec.js index d1e7566135..80a078c4c9 100644 --- a/test/services/cloudfront.spec.js +++ b/test/services/cloudfront.spec.js @@ -27,7 +27,7 @@ var api, params, xml; helpers.mockHttpResponse(200, {}, ''); api = cf.api.apiVersion; - xml = "\n \n 2\n \n path1\n path2\n \n \n abc\n"; + xml = '\n \n 2\n \n path1\n path2\n \n \n abc\n'; params = { DistributionId: 'ID', InvalidationBatch: { @@ -41,7 +41,7 @@ return cf.createInvalidation(params, function(err, data) { var req; req = this.request.httpRequest; - expect(req.path).to.equal("/" + api + "/distribution/ID/invalidation"); + expect(req.path).to.equal('/' + api + '/distribution/ID/invalidation'); return helpers.matchXML(req.body, xml); }); }); diff --git a/test/services/cloudsearchdomain.spec.js b/test/services/cloudsearchdomain.spec.js index a2d18b5e85..3b79531e6d 100644 --- a/test/services/cloudsearchdomain.spec.js +++ b/test/services/cloudsearchdomain.spec.js @@ -47,7 +47,7 @@ return new AWS.CloudSearchDomain({ endpoint: 'host.domain' }); - }).not.to["throw"](); + }).not.to['throw'](); }); }); return describe('building a request', function() { @@ -110,7 +110,7 @@ req = build('suggest', params); expect(req.method).to.equal('GET'); expect(req.path.split('?')[1]).to.equal('format=sdk&pretty=true&q=foo&suggester=bar'); - return expect(!!req.body).to.be["false"]; + return expect(!!req.body).to.be['false']; }); }); }); diff --git a/test/services/dynamodb.spec.js b/test/services/dynamodb.spec.js index 761730c805..55d010a4f1 100644 --- a/test/services/dynamodb.spec.js +++ b/test/services/dynamodb.spec.js @@ -108,7 +108,7 @@ describe('AWS.DynamoDB', function() { err = null; helpers.mockHttpResponse(200, { 'x-amz-crc32': '0' - }, "{\"TableNames\":[\"mock-table\"]}"); + }, '{"TableNames":["mock-table"]}'); request = dynamo.listTables(); s = request.createReadStream(); s.on('error', function(e) { @@ -126,7 +126,7 @@ describe('AWS.DynamoDB', function() { var request; helpers.mockHttpResponse(200, { 'x-amz-crc32': '1575962599' - }, "{\"TableNames\":[\"mock-table\"]}"); + }, '{"TableNames":["mock-table"]}'); request = dynamo.listTables(); return request.send(function(err, data) { return expect(err).to.eql(null); @@ -135,7 +135,7 @@ describe('AWS.DynamoDB', function() { it('does not verify response checksum when no [x-amz-crc32] header', function() { var request; - helpers.mockHttpResponse(200, {}, "{\"TableNames\":[\"mock-table\"]}"); + helpers.mockHttpResponse(200, {}, '{"TableNames":["mock-table"]}'); request = dynamo.listTables(); return request.send(function(err, data) { return expect(err).to.eql(null); @@ -146,7 +146,7 @@ describe('AWS.DynamoDB', function() { var request; helpers.mockHttpResponse(200, { 'x-amz-crc32': '0' - }, "{\"TableNames\":[\"mock-table\"]}"); + }, '{"TableNames":["mock-table"]}'); request = dynamo.listTables(); return request.send(function(err, data) { expect(err.code).to.eql('CRC32CheckFailed'); @@ -158,7 +158,7 @@ describe('AWS.DynamoDB', function() { var request; helpers.mockHttpResponse(200, { 'x-amz-crc32': '0' - }, "{\"TableNames\":[\"mock-table\"]}"); + }, '{"TableNames":["mock-table"]}'); request = dynamo.listTables(); return request.send(function(err, data) { return expect(this.retryCount).to.eql(10); diff --git a/test/services/ec2.spec.js b/test/services/ec2.spec.js index f3c0ca59e4..7fa0617022 100644 --- a/test/services/ec2.spec.js +++ b/test/services/ec2.spec.js @@ -85,7 +85,7 @@ }; return describe('with error', function() { beforeEach(function() { - return body = "\n \n \n InvalidInstanceID.Malformed\n Invalid id: \"i-12345678\"\n \n \n ab123mno-6432-dceb-asdf-123mno543123\n"; + return body = '\n \n \n InvalidInstanceID.Malformed\n Invalid id: "i-12345678"\n \n \n ab123mno-6432-dceb-asdf-123mno543123\n'; }); it('extracts the error code', function() { return parse(function(error, data) { diff --git a/test/services/rds.spec.js b/test/services/rds.spec.js index 6b35e092ed..8015b3a8e2 100644 --- a/test/services/rds.spec.js +++ b/test/services/rds.spec.js @@ -11,7 +11,7 @@ return it('properly parses XML response', function() { var body, params, rds; rds = new AWS.RDS(); - body = "\n \n \n \n foo\n \n 1234567890\n foo\n \n \n \n 1234567890\n \n"; + body = '\n \n \n \n foo\n \n 1234567890\n foo\n \n \n \n 1234567890\n \n'; helpers.mockHttpResponse(200, {}, body); params = { DBSecurityGroupName: 'foo', diff --git a/test/services/route53.spec.js b/test/services/route53.spec.js index 69dee6bf35..34eb6f4d9e 100644 --- a/test/services/route53.spec.js +++ b/test/services/route53.spec.js @@ -50,7 +50,7 @@ describe('changeResourceRecordSets', function() { return it('correctly builds the XML document', function() { var params, xml; - xml = "\n \n comment\n \n \n CREATE\n \n name\n type\n \n \n foo.com\n \n \n \n \n \n \n"; + xml = '\n \n comment\n \n \n CREATE\n \n name\n type\n \n \n foo.com\n \n \n \n \n \n \n'; helpers.mockHttpResponse(200, {}, ''); params = { HostedZoneId: 'zone-id', @@ -84,7 +84,7 @@ code: 'PriorRequestNotComplete', statusCode: 400 }; - return expect(service.retryableError(err)).to.be["true"]; + return expect(service.retryableError(err)).to.be['true']; }); return it('retryableError returns false for other 400 errors', function() { var err; @@ -92,7 +92,7 @@ code: 'SomeErrorCode', statusCode: 400 }; - return expect(service.retryableError(err)).to.be["false"]; + return expect(service.retryableError(err)).to.be['false']; }); }); }); diff --git a/test/services/s3.spec.js b/test/services/s3.spec.js index 33152409af..75afa23c61 100644 --- a/test/services/s3.spec.js +++ b/test/services/s3.spec.js @@ -66,7 +66,7 @@ describe('AWS.S3', function() { return new AWS.S3({ s3BucketEndpoint: true }); - }).to["throw"](/An endpoint must be provided/); + }).to['throw'](/An endpoint must be provided/); }); }); @@ -549,7 +549,7 @@ describe('AWS.S3', function() { var req = build('putObject', { Bucket: 'foobar', Key: 'foo' - }) + }); expect(req.path).to.equal('/foo'); expect(req.virtualHostedBucket).to.equal('foobar'); }); @@ -558,7 +558,7 @@ describe('AWS.S3', function() { var req = build('putObject', { Bucket: 'foobar', Key: 'foobar' - }) + }); expect(req.path).to.equal('/foobar'); expect(req.virtualHostedBucket).to.equal('foobar'); }); @@ -568,7 +568,7 @@ describe('AWS.S3', function() { Bucket: 'foobar', Key: 'foobar', VersionId: 'null' - }) + }); expect(req.path).to.equal('/foobar?versionId=null'); expect(req.virtualHostedBucket).to.equal('foobar'); }); @@ -1350,7 +1350,7 @@ describe('AWS.S3', function() { var req = request('operation', { Bucket: 'name' }); - var body = "\n InvalidArgument\n Provided param is bad\n eu-west-1\n"; + var body = '\n InvalidArgument\n Provided param is bad\n eu-west-1\n'; var error = extractError(400, body, {}, req); expect(error.region).to.equal('eu-west-1'); expect(s3.bucketRegionCache.name).to.equal('eu-west-1'); @@ -1361,7 +1361,7 @@ describe('AWS.S3', function() { var req = request('operation', { Bucket: 'name' }); - var body = "\n InvalidArgument\n Provided param is bad\n eu-west-1\n"; + var body = '\n InvalidArgument\n Provided param is bad\n eu-west-1\n'; var headers = { 'x-amz-bucket-region': 'us-east-1' }; @@ -1375,7 +1375,7 @@ describe('AWS.S3', function() { var req = request('operation', { Bucket: 'name' }); - var body = "\n InvalidArgument\n Provided param is bad\n"; + var body = '\n InvalidArgument\n Provided param is bad\n'; var error = extractError(400, body, {}, req); expect(error.region).to.equal('us-west-2'); expect(s3.bucketRegionCache.name).to.equal('us-west-2'); @@ -1387,7 +1387,7 @@ describe('AWS.S3', function() { Bucket: 'name' }); req.httpRequest.region = 'us-west-2'; - var body = "\n InvalidArgument\n Provided param is bad\n"; + var body = '\n InvalidArgument\n Provided param is bad\n'; var error = extractError(400, body); expect(error.region).to.not.exist; expect(s3.bucketRegionCache.name).to.equal('us-west-2'); @@ -1402,7 +1402,7 @@ describe('AWS.S3', function() { var req = request('operation', { Bucket: 'name' }); - var body = "\n PermanentRedirect\n Message\n"; + var body = '\n PermanentRedirect\n Message\n'; var headers = { 'x-amz-bucket-region': 'us-east-1' }; @@ -1423,12 +1423,12 @@ describe('AWS.S3', function() { Bucket: 'name' }; var req = request('operation', params); - var body = "\n PermanentRedirect\n Message\n"; + var body = '\n PermanentRedirect\n Message\n'; var error = extractError(301, body, {}, req); expect(error.region).to.not.exist; expect(spy.calls.length).to.equal(1); - expect(spy.calls[0]["arguments"][0].Bucket).to.equal('name'); - expect(spy.calls[0]["arguments"][0].MaxKeys).to.equal(maxKeysParam); + expect(spy.calls[0]['arguments'][0].Bucket).to.equal('name'); + expect(spy.calls[0]['arguments'][0].MaxKeys).to.equal(maxKeysParam); expect(regionReq._requestRegionForBucket).to.exist; }); @@ -1442,7 +1442,7 @@ describe('AWS.S3', function() { var req = request('operation', { Bucket: 'name' }); - var body = "\n InvalidCode\n Message\n"; + var body = '\n InvalidCode\n Message\n'; var error = extractError(301, body, {}, req); expect(error.region).to.not.exist; expect(spy.calls.length).to.equal(0); @@ -1460,11 +1460,11 @@ describe('AWS.S3', function() { var req = request('operation', { Bucket: 'name' }); - var body = "\n PermanentRedirect\n Message\n"; + var body = '\n PermanentRedirect\n Message\n'; var error = extractError(301, body, {}, req); expect(spy.calls.length).to.equal(1); - expect(spy.calls[0]["arguments"][0].Bucket).to.equal('name'); - expect(spy.calls[0]["arguments"][0].MaxKeys).to.equal(maxKeysParam); + expect(spy.calls[0]['arguments'][0].Bucket).to.equal('name'); + expect(spy.calls[0]['arguments'][0].MaxKeys).to.equal(maxKeysParam); expect(error.region).to.equal('us-west-2'); }); @@ -1481,7 +1481,7 @@ describe('AWS.S3', function() { }); it('uses canned errors only when the body is empty', function() { - var body = "\n ErrorCode\n ErrorMessage\n"; + var body = '\n ErrorCode\n ErrorMessage\n'; var error = extractError(403, body); expect(error.code).to.equal('ErrorCode'); expect(error.message).to.equal('ErrorMessage'); @@ -2073,7 +2073,7 @@ describe('AWS.S3', function() { var headers = { 'x-amz-request-id': 'request-id' }; - var body = "\n \n \n \n aws-sdk\n id\n \n FULL_CONTROL\n \n \n \n uri\n \n READ\n \n \n \n aws-sdk\n id\n \n"; + var body = '\n \n \n \n aws-sdk\n id\n \n FULL_CONTROL\n \n \n \n uri\n \n READ\n \n \n \n aws-sdk\n id\n \n'; helpers.mockHttpResponse(200, headers, body); s3.getBucketAcl(function(error, data) { expect(error).to.equal(null); @@ -2107,7 +2107,7 @@ describe('AWS.S3', function() { describe('putBucketAcl', function() { it('correctly builds the ACL XML document', function(done) { - var xml = "\n \n \n \n aws-sdk\n id\n \n FULL_CONTROL\n \n \n \n uri\n \n READ\n \n \n \n aws-sdk\n id\n \n"; + var xml = '\n \n \n \n aws-sdk\n id\n \n FULL_CONTROL\n \n \n \n uri\n \n READ\n \n \n \n aws-sdk\n id\n \n'; helpers.mockHttpResponse(200, {}, ''); var params = { AccessControlPolicy: { @@ -2146,7 +2146,7 @@ describe('AWS.S3', function() { 'x-amz-id-2': 'Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==', 'x-amz-request-id': '656c76696e6727732072657175657374' }; - var body = "\n\n http://Example-Bucket.s3.amazonaws.com/Example-Object\n Example-Bucket\n Example-Object\n \"3858f62230ac3c915f300c664312c11f-9\"\n"; + var body = '\n\n http://Example-Bucket.s3.amazonaws.com/Example-Object\n Example-Bucket\n Example-Object\n "3858f62230ac3c915f300c664312c11f-9"\n'; helpers.mockHttpResponse(200, headers, body); s3.completeMultipartUpload(function(error, data) { expect(error).to.equal(null); @@ -2162,7 +2162,7 @@ describe('AWS.S3', function() { }); it('returns an error when the resp is 200 with an error xml document', function(done) { - var body = "\n\n InternalError\n We encountered an internal error. Please try again.\n 656c76696e6727732072657175657374\n Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==\n"; + var body = '\n\n InternalError\n We encountered an internal error. Please try again.\n 656c76696e6727732072657175657374\n Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==\n'; helpers.mockHttpResponse(200, {}, body); s3.completeMultipartUpload(function(error, data) { expect(error).to.be.instanceOf(Error); @@ -2182,7 +2182,7 @@ describe('AWS.S3', function() { 'x-amz-id-2': 'Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==', 'x-amz-request-id': '656c76696e6727732072657175657374' }; - var body = "\n\n http://Example-Bucket.s3.amazonaws.com/Example-Object\n Example-Bucket\n Example-Object\n \"3858f62230ac3c915f300c664312c11f-9\"\n"; + var body = '\n\n http://Example-Bucket.s3.amazonaws.com/Example-Object\n Example-Bucket\n Example-Object\n "3858f62230ac3c915f300c664312c11f-9"\n'; helpers.mockHttpResponse(200, headers, body); s3.copyObject(function(error, data) { expect(error).to.equal(null); @@ -2197,7 +2197,7 @@ describe('AWS.S3', function() { }); it('returns an error when the resp is 200 with an error xml document', function(done) { - var body = "\n\n InternalError\n We encountered an internal error. Please try again.\n 656c76696e6727732072657175657374\n Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==\n"; + var body = '\n\n InternalError\n We encountered an internal error. Please try again.\n 656c76696e6727732072657175657374\n Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==\n'; helpers.mockHttpResponse(200, {}, body); s3.copyObject(function(error, data) { expect(error).to.be.instanceOf(Error); @@ -2217,7 +2217,7 @@ describe('AWS.S3', function() { 'x-amz-id-2': 'Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==', 'x-amz-request-id': '656c76696e6727732072657175657374' }; - var body = "\n\n http://Example-Bucket.s3.amazonaws.com/Example-Object\n Example-Bucket\n Example-Object\n \"3858f62230ac3c915f300c664312c11f-9\"\n"; + var body = '\n\n http://Example-Bucket.s3.amazonaws.com/Example-Object\n Example-Bucket\n Example-Object\n "3858f62230ac3c915f300c664312c11f-9"\n'; helpers.mockHttpResponse(200, headers, body); s3.uploadPartCopy({ Bucket: 'bucket', @@ -2236,7 +2236,7 @@ describe('AWS.S3', function() { }); it('returns an error when the resp is 200 with an error xml document', function(done) { - var body = "\n\n InternalError\n We encountered an internal error. Please try again.\n 656c76696e6727732072657175657374\n Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==\n"; + var body = '\n\n InternalError\n We encountered an internal error. Please try again.\n 656c76696e6727732072657175657374\n Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==\n'; helpers.mockHttpResponse(200, {}, body); s3.uploadPartCopy(function(error, data) { expect(error).to.be.instanceOf(Error); @@ -2607,8 +2607,8 @@ describe('AWS.S3', function() { }); req.send(function(err) { - expect(mock.calls[0]["arguments"]).to.eql(['path/to/file']); - expect(mock.calls[1]["arguments"]).to.eql(['path/to/file', {}]); + expect(mock.calls[0]['arguments']).to.eql(['path/to/file']); + expect(mock.calls[1]['arguments']).to.eql(['path/to/file', {}]); expect(err).not.to.exist; expect(req.httpRequest.headers['X-Amz-Content-Sha256']).to.equal(hash); done(); @@ -2654,13 +2654,13 @@ describe('AWS.S3', function() { Body: stream }); req.send(function(err) { - expect(mock.calls[0]["arguments"]).to.eql([ + expect(mock.calls[0]['arguments']).to.eql([ 'path/to/file', { start: 0, end: 5 } ]); - expect(mock.calls[1]["arguments"]).to.eql([ + expect(mock.calls[1]['arguments']).to.eql([ 'path/to/file', { start: 0, end: 5 @@ -2899,7 +2899,7 @@ describe('AWS.S3', function() { Key: 'key', ContentLength: 5 }); - }).to["throw"](/ContentLength is not supported in pre-signed URLs/); + }).to['throw'](/ContentLength is not supported in pre-signed URLs/); }); it('defers the execution of a callback, even when the underlying credentials are synchronous', function(done) { @@ -3033,9 +3033,9 @@ describe('AWS.S3', function() { found[conditionKey] = true; expect(condition[conditionKey]).to.equal(data.fields[conditionKey]); } - expect(found['X-Amz-Algorithm']).to.be["true"]; - expect(found['X-Amz-Date']).to.be["true"]; - expect(found['X-Amz-Credential']).to.be["true"]; + expect(found['X-Amz-Algorithm']).to.be['true']; + expect(found['X-Amz-Date']).to.be['true']; + expect(found['X-Amz-Credential']).to.be['true']; done(); }); }); @@ -3102,7 +3102,7 @@ describe('AWS.S3', function() { var body = new Buffer(policy); helpers.mockHttpResponse(200, {}, body); s3.getBucketPolicy(function(err, data) { - expect(Buffer.isBuffer(data.Policy)).to.be["false"]; + expect(Buffer.isBuffer(data.Policy)).to.be['false']; expect(data.Policy).to.eql(policy); done(); }); diff --git a/test/services/s3control.spec.js b/test/services/s3control.spec.js index fc6c7f64f0..1b520e514e 100644 --- a/test/services/s3control.spec.js +++ b/test/services/s3control.spec.js @@ -27,7 +27,7 @@ describe('AWS.S3Control', function() { helpers.mockResponse({data: {}}); request.send(); expect(request.httpRequest.headers.Host).to.eql('222.s3-control.dualstack.us-east-1.amazonaws.com'); - expect(request.httpRequest.endpoint.hostname).to.eql('222.s3-control.dualstack.us-east-1.amazonaws.com'); + expect(request.httpRequest.endpoint.hostname).to.eql('222.s3-control.dualstack.us-east-1.amazonaws.com'); }); it('append accountId to hostname when supplied and using customized endpoint', function() { @@ -36,8 +36,8 @@ describe('AWS.S3Control', function() { helpers.mockResponse({data: {}}); request.send(); expect(request.httpRequest.headers.Host).to.eql('222.s3-control-fips.us-east-1.amazonaws.com'); - expect(request.httpRequest.endpoint.hostname).to.eql('222.s3-control-fips.us-east-1.amazonaws.com'); - }) + expect(request.httpRequest.endpoint.hostname).to.eql('222.s3-control-fips.us-east-1.amazonaws.com'); + }); it('should add hostId and requestId to exception response', function() { var client = new AWS.S3Control({region: 'us-east-1'}); @@ -45,7 +45,7 @@ describe('AWS.S3Control', function() { helpers.mockHttpResponse(404, { 'x-amz-request-id': 'requestId123', 'x-amz-id-2': 'hostId321', - }, 'NoSuchAccountThe account was not found111requestId123hostId321') + }, 'NoSuchAccountThe account was not found111requestId123hostId321'); request.send(function(err, data) { expect(data).to.eql(null); expect(err.extendedRequestId).to.eql('hostId321'); @@ -61,17 +61,17 @@ describe('AWS.S3Control', function() { helpers.mockHttpResponse(200, { 'x-amz-request-id': 'requestId123', 'x-amz-id-2': 'hostId321', - }, '') + }, ''); request.send(function(err, data) { expect(err).to.eql(null); expect(this.extendedRequestId).to.eql('hostId321'); expect(this.requestId).to.eql('requestId123'); }); - }) + }); it('should use the V4 signer', function() { var client = new AWS.S3Control(); - expect(client.getSignerClass()).to.eql(AWS.Signers.V4) + expect(client.getSignerClass()).to.eql(AWS.Signers.V4); }); it('does not double encode path for S3Control', function() { @@ -83,7 +83,7 @@ describe('AWS.S3Control', function() { RejectPublicAcls: false } }).build(); - req.httpRequest.path = '/fake%3Apath' + req.httpRequest.path = '/fake%3Apath'; var SignerClass = client.getSignerClass(req); signer = new SignerClass(req.httpRequest, req.service.api.signingName || req.service.api.endpointPrefix); return expect(signer.canonicalString().split('\n')[1]).to.equal('/fake%3Apath'); @@ -101,7 +101,7 @@ describe('AWS.S3Control', function() { expect(response.error.code).to.eql('ValidationError'); expect(response.error.message).to.eql('AccountId must be a string.'); } - }) + }); it('validate accountId length', function() { var client = new AWS.S3Control({region: 'us-east-1'}); @@ -127,7 +127,7 @@ describe('AWS.S3Control', function() { var response = request.response; expect(response.error).to.be.null; } - + }); @@ -150,4 +150,4 @@ describe('AWS.S3Control', function() { expect(request.response.error).to.be.null; } }); -}); \ No newline at end of file +}); diff --git a/test/services/sqs.spec.js b/test/services/sqs.spec.js index 944a3e8654..28eea59375 100644 --- a/test/services/sqs.spec.js +++ b/test/services/sqs.spec.js @@ -51,7 +51,7 @@ }; md5 = 'acbd18db4cc2f85cedef654fccc4a4d8'; payload = function(md5) { - return "\n " + md5 + "\n MSGID\n"; + return '\n ' + md5 + '\n MSGID\n'; }; it('correctly validates MD5 of message input', function(done) { return checksumValidate('sendMessage', input, payload(md5), true, function(err, data) { @@ -92,7 +92,7 @@ md5foo = 'acbd18db4cc2f85cedef654fccc4a4d8'; md5bar = '37b51d194a7513e45b56f6524f2d51f2'; payload = function(md5a, md5b, md5c) { - return "\n \n a\n MSGID1\n " + md5a + "\n \n \n b\n MSGID2\n " + md5b + "\n \n \n c\n MSGID3\n " + md5c + "\n \n"; + return '\n \n a\n MSGID1\n ' + md5a + '\n \n \n b\n MSGID2\n ' + md5b + '\n \n \n c\n MSGID3\n ' + md5c + '\n \n'; }; it('correctly validates MD5 of operation', function(done) { var output; @@ -126,7 +126,7 @@ var md5, payload; md5 = 'acbd18db4cc2f85cedef654fccc4a4d8'; payload = function(body, md5, id) { - return "\n " + body + "\n " + md5 + "\n " + id + "\n"; + return '\n ' + body + '\n ' + md5 + '\n ' + id + '\n'; }; it('correctly validates MD5 of operation', function(done) { var output; diff --git a/test/shared_ini.spec.js b/test/shared_ini.spec.js index c1ab01e6d5..b56beb5b11 100644 --- a/test/shared_ini.spec.js +++ b/test/shared_ini.spec.js @@ -5,7 +5,7 @@ var IniLoader = AWS.IniLoader; function validateCachedFiles(iniFile, expectedCache) { if (!expectedCache) return false; - helpers.spyOn(AWS.util, 'readFileSync').andCallFake(function() {throw new Error('shouldn\'t load new profiles')}) + helpers.spyOn(AWS.util, 'readFileSync').andCallFake(function() {throw new Error('shouldn\'t load new profiles');}); for (var i = 0, filePaths = Object.keys(expectedCache); i < filePaths.length; i++) { var path = filePaths[i]; expect(iniFile.loadFrom({filename: path})).to.eql(expectedCache[path]); @@ -22,12 +22,12 @@ if (AWS.util.isNode()) { env = process.env; process.env = {}; }); - + afterEach(function() { os.homedir = homedir; process.env = env; }); - + describe ('constructor', function() { it('should only read config file lazily when need to', function() { helpers.spyOn(os, 'homedir').andReturn('/foo/bar/baz'); @@ -36,14 +36,14 @@ if (AWS.util.isNode()) { expect(AWS.util.readFileSync.calls.length).to.equal(0); }); }); - + describe('loadFrom', function() { var iniLoader; - + beforeEach(function() { iniLoader = new IniLoader(); - }) - + }); + it('load config file with profile name indexed', function () { helpers.spyOn(AWS.util, 'readFileSync').andCallFake(function(path) { if (path === '/User/foo/config') { @@ -65,29 +65,29 @@ if (AWS.util.isNode()) { } }); }); - + it('load default profiles filename is not supplied', function() { process.env.HOME = '/foo'; helpers.spyOn(AWS.util, 'readFileSync').andCallFake(function(path) { if (path === '/foo/.aws/config') return '[default]\naws_access_key_id = akid\naws_secret_access_key = secret'; - else return '[default]\naws_access_key_id = akid2\naws_secret_access_key = secret2' + else return '[default]\naws_access_key_id = akid2\naws_secret_access_key = secret2'; }); var iniFile = new IniLoader(); expect(iniFile.loadFrom({isConfig: true})).to.eql({'default': {'aws_access_key_id': 'akid', 'aws_secret_access_key': 'secret'}}); expect(iniFile.loadFrom({})).to.eql({'default': {'aws_access_key_id': 'akid2', 'aws_secret_access_key': 'secret2'}}); }); - + it('load credentials file if isConfig parameter is not set', function() { helpers.spyOn(AWS.util, 'readFileSync').andCallFake(function(path) { if (path === '/foo/bar') return '[profile user]\naws_access_key_id = akid\naws_secret_access_key = secret'; - else if (path === '/foo/qux') return '[profile user2]\naws_access_key_id = akid2\naws_secret_access_key = secret2' + else if (path === '/foo/qux') return '[profile user2]\naws_access_key_id = akid2\naws_secret_access_key = secret2'; }); var iniFile = new IniLoader(); expect(iniFile.loadFrom({isConfig: true, filename: '/foo/bar'})).to.eql({'user': {'aws_access_key_id': 'akid', 'aws_secret_access_key': 'secret'}}); //for credients, the prefix 'profile ' of the profile name won't be removed expect(iniFile.loadFrom({filename: '/foo/qux'})).to.eql({'profile user2': {'aws_access_key_id': 'akid2', 'aws_secret_access_key': 'secret2'}}); }); - + it('won\'t load same file twice', function() { helpers.spyOn(AWS.util, 'readFileSync').andReturn(''); iniLoader.loadFrom({filename: 'foo'}); @@ -126,7 +126,7 @@ if (AWS.util.isNode()) { expect(os.homedir.calls.length).to.eql(0); }); }); - + describe('clearCachedFiles', function() { it('remove all cached files', function() { process.env.HOME = '/foo'; @@ -143,7 +143,7 @@ if (AWS.util.isNode()) { iniFile.clearCachedFiles(); iniFile.loadFrom(); expect(AWS.util.readFileSync.calls.length).to.eql(1); - }) + }); }); describe('resolvedProfiles', function() { @@ -152,7 +152,7 @@ if (AWS.util.isNode()) { process.env.HOME = '/foo'; helpers.spyOn(AWS.util, 'readFileSync').andCallFake(function(path) { if (path === '/foo/.aws/config') return '[default]\naws_access_key_id = akid\naws_secret_access_key = secret'; - else return '[default]\naws_access_key_id = akid2\naws_secret_access_key = secret2' + else return '[default]\naws_access_key_id = akid2\naws_secret_access_key = secret2'; }); iniFile = new IniLoader(); iniFile.loadFrom({isConfig: true}); @@ -201,4 +201,4 @@ if (AWS.util.isNode()) { }); }); }); -} \ No newline at end of file +} diff --git a/test/signers/presign.spec.js b/test/signers/presign.spec.js index c8291284d5..2c216002c4 100644 --- a/test/signers/presign.spec.js +++ b/test/signers/presign.spec.js @@ -12,7 +12,7 @@ describe('AWS.Signers.Presign', function() { var resultUrl; - resultUrl = "https://monitoring.mock-region.amazonaws.com/?" + ("Action=ListMetrics&Version=" + cw.api.apiVersion + "&") + "X-Amz-Algorithm=AWS4-HMAC-SHA256&" + "X-Amz-Credential=akid%2F19700101%2Fmock-region%2Fmonitoring%2Faws4_request&" + "X-Amz-Date=19700101T000000Z&X-Amz-Expires=3600&X-Amz-Security-Token=session&" + "X-Amz-Signature=953bd6d74e86c12adc305f656473d614269d2f20a0c18c5edbb3d7f57ca2b439&" + "X-Amz-SignedHeaders=host"; + resultUrl = 'https://monitoring.mock-region.amazonaws.com/?' + ('Action=ListMetrics&Version=' + cw.api.apiVersion + '&') + 'X-Amz-Algorithm=AWS4-HMAC-SHA256&' + 'X-Amz-Credential=akid%2F19700101%2Fmock-region%2Fmonitoring%2Faws4_request&' + 'X-Amz-Date=19700101T000000Z&X-Amz-Expires=3600&X-Amz-Security-Token=session&' + 'X-Amz-Signature=953bd6d74e86c12adc305f656473d614269d2f20a0c18c5edbb3d7f57ca2b439&' + 'X-Amz-SignedHeaders=host'; beforeEach(function() { helpers.spyOn(cw, 'getSkewCorrectedDate').andReturn(new Date(0)); return helpers.spyOn(AWS.util.date, 'getDate').andReturn(new Date(0)); @@ -30,7 +30,7 @@ return cw.listMetrics({ InvalidParameter: true }).presign(); - }).to["throw"](/Unexpected key/); + }).to['throw'](/Unexpected key/); }); it('allows specifying different expiry time', function() { return expect(cw.listMetrics().presign(900)).to.contain('X-Amz-Expires=900&'); diff --git a/test/signers/s3.spec.js b/test/signers/s3.spec.js index 156796b243..cb06565eeb 100644 --- a/test/signers/s3.spec.js +++ b/test/signers/s3.spec.js @@ -117,80 +117,80 @@ return headers['X-Amz-Date'] = 'DATE-STRING'; }); it('builds a basic string to sign', function() { - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/'); }); it('includes content md5 and content type when present', function() { headers['Content-Type'] = 'CONTENT-TYPE'; headers['Content-MD5'] = 'CONTENT-MD5'; - return expect(stringToSign()).to.equal("POST\nCONTENT-MD5\nCONTENT-TYPE\n\nx-amz-date:DATE-STRING\n/"); + return expect(stringToSign()).to.equal('POST\nCONTENT-MD5\nCONTENT-TYPE\n\nx-amz-date:DATE-STRING\n/'); }); it('includes the http method, whatever it is', function() { method = 'VERB'; - return expect(stringToSign()).to.equal("VERB\n\n\n\nx-amz-date:DATE-STRING\n/"); + return expect(stringToSign()).to.equal('VERB\n\n\n\nx-amz-date:DATE-STRING\n/'); }); it('includes any x-amz- style headers, but not others', function() { headers['X-Amz-Abc'] = 'abc'; headers['X-Amz-Xyz'] = 'xyz'; headers['random-header'] = 'random'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-abc:abc\nx-amz-date:DATE-STRING\nx-amz-xyz:xyz\n/"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-abc:abc\nx-amz-date:DATE-STRING\nx-amz-xyz:xyz\n/'); }); it('includes x-amz- headers that are lower-cased', function() { headers['x-amz-Abc'] = 'abc'; headers['x-amz-Xyz'] = 'xyz'; headers['random-header'] = 'random'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-abc:abc\nx-amz-date:DATE-STRING\nx-amz-xyz:xyz\n/"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-abc:abc\nx-amz-date:DATE-STRING\nx-amz-xyz:xyz\n/'); }); it('sorts headers by their name', function() { headers['x-amz-mno'] = 'mno'; headers['x-amz-Xyz'] = 'xyz'; headers['x-amz-Abc'] = 'abc'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-abc:abc\nx-amz-date:DATE-STRING\nx-amz-mno:mno\nx-amz-xyz:xyz\n/"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-abc:abc\nx-amz-date:DATE-STRING\nx-amz-mno:mno\nx-amz-xyz:xyz\n/'); }); it('builds a canonical resource from the path', function() { path = '/bucket_name/key'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket_name/key"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket_name/key'); }); it('appends the bucket to the path when it is part of the hostname', function() { path = '/'; virtualHostedBucket = 'bucket-name'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket-name/"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket-name/'); }); it('appends the subresource portion of the path querystring', function() { path = '/?acl'; virtualHostedBucket = 'bucket-name'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket-name/?acl"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket-name/?acl'); }); it('includes the sub resource value when present', function() { path = '/bucket_name/key?versionId=123'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket_name/key?versionId=123"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/bucket_name/key?versionId=123'); }); it('omits non-sub-resource querystring params from the resource string', function() { path = '/?versionId=abc&next-marker=xyz'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/?versionId=abc"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/?versionId=abc'); }); it('sorts sub resources by name', function() { path = '/?logging&acl&website&torrent=123'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/?acl&logging&torrent=123&website"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/?acl&logging&torrent=123&website'); }); it('sorts sub resources by name', function() { path = '/?logging&acl&website&torrent=123'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/?acl&logging&torrent=123&website"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/?acl&logging&torrent=123&website'); }); it('includes the un-decoded query string param for sub resources', function() { path = '/?versionId=a%2Bb'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/?versionId=a%2Bb"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/?versionId=a%2Bb'); }); it('includes the replication subresource without a value', function() { path = '/?replication'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/?replication"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/?replication'); }); it('includes the non-encoded query string get header overrides', function() { path = '/?response-content-type=a%2Bb'; - return expect(stringToSign()).to.equal("POST\n\n\n\nx-amz-date:DATE-STRING\n/?response-content-type=a+b"); + return expect(stringToSign()).to.equal('POST\n\n\n\nx-amz-date:DATE-STRING\n/?response-content-type=a+b'); }); return it('omits the date header when not present', function() { delete headers['X-Amz-Date']; - return expect(stringToSign()).to.equal("POST\n\n\n\n/"); + return expect(stringToSign()).to.equal('POST\n\n\n\n/'); }); }); }); diff --git a/test/signers/v4.spec.js b/test/signers/v4.spec.js index c4da06a09a..021b504c11 100644 --- a/test/signers/v4.spec.js +++ b/test/signers/v4.spec.js @@ -161,12 +161,12 @@ signer = new AWS.Signers.V4(req.httpRequest, 's3'); return expect(signer.canonicalString().split('\n')[1]).to.equal('/a%3Ab%3Ac'); }); - + it('does not double encode path for signature version s3v4', function() { var api = { metadata: { - protocol: "rest-xml", - signatureVersion: "s3v4", + protocol: 'rest-xml', + signatureVersion: 's3v4', }, operations: { AnOperation: { @@ -192,7 +192,7 @@ signatureVersion: req.service.api.signatureVersion }); expect(signer.canonicalString().split('\n')[1]).to.equal('/fakepath/test%3Atest'); - }) + }); }); describe('canonicalHeaders', function() { diff --git a/test/util.spec.js b/test/util.spec.js index 9fdce4fd46..33927ae028 100644 --- a/test/util.spec.js +++ b/test/util.spec.js @@ -538,7 +538,7 @@ it('callback should not change "this" scope', function() { return new function() { var self; - this["class"] = 'MyClass'; + this['class'] = 'MyClass'; self = this; return AWS.util.each.apply(this, [ [1, 2, 3], function() { @@ -741,7 +741,7 @@ }); derived = new Derived(1, 2, 'three'); expect(derived.other).to.equal(true); - return expect(Base.prototype.constructor.calls[0]["arguments"]).to.eql([1, 2, 'three']); + return expect(Base.prototype.constructor.calls[0]['arguments']).to.eql([1, 2, 'three']); }); }); @@ -1246,27 +1246,27 @@ }); if (AWS.util.isNode()) { it('accepts service identifier string as argument', function() { - expect(AWS.util.isDualstackAvailable('mock')).to.be["false"]; + expect(AWS.util.isDualstackAvailable('mock')).to.be['false']; metadata.mock.dualstackAvailable = true; - return expect(AWS.util.isDualstackAvailable('mock')).to.be["true"]; + return expect(AWS.util.isDualstackAvailable('mock')).to.be['true']; }); it('accepts service client instance as argument', function() { var service; service = new helpers.MockService(); - expect(AWS.util.isDualstackAvailable(service)).to.be["false"]; + expect(AWS.util.isDualstackAvailable(service)).to.be['false']; metadata.mock.dualstackAvailable = true; - return expect(AWS.util.isDualstackAvailable(service)).to.be["true"]; + return expect(AWS.util.isDualstackAvailable(service)).to.be['true']; }); it('accepts service constructor as argument', function() { - expect(AWS.util.isDualstackAvailable(helpers.MockService)).to.be["false"]; + expect(AWS.util.isDualstackAvailable(helpers.MockService)).to.be['false']; metadata.mock.dualstackAvailable = true; - return expect(AWS.util.isDualstackAvailable(helpers.MockService)).to.be["true"]; + return expect(AWS.util.isDualstackAvailable(helpers.MockService)).to.be['true']; }); } return it('returns false if invalid service is given as argument', function() { - expect(AWS.util.isDualstackAvailable(null)).to.be["false"]; - expect(AWS.util.isDualstackAvailable('invalid')).to.be["false"]; - return expect(AWS.util.isDualstackAvailable({})).to.be["false"]; + expect(AWS.util.isDualstackAvailable(null)).to.be['false']; + expect(AWS.util.isDualstackAvailable('invalid')).to.be['false']; + return expect(AWS.util.isDualstackAvailable({})).to.be['false']; }); }); @@ -1517,7 +1517,7 @@ return resp.end(); }; return sendRequest(function(err, data) { - expect(err).to.be["null"]; + expect(err).to.be['null']; expect(data).to.equal('FOOBAR'); expect(spy.calls.length).to.equal(1); return done(); @@ -1537,7 +1537,7 @@ return resp.end(); }; return sendRequest(function(err, data) { - expect(err).to.be["null"]; + expect(err).to.be['null']; expect(data).to.equal('FOOBAR'); expect(spy.calls.length).to.equal(2); return done(); @@ -1553,9 +1553,9 @@ }; return sendRequest(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; + expect(err).to.not.be['null']; expect(err.code).to.equal('TimeoutError'); - expect(err.retryable).to.be["true"]; + expect(err.retryable).to.be['true']; expect(spy.calls.length).to.equal(options.maxRetries + 1); return done(); }); @@ -1568,8 +1568,8 @@ }; return sendRequest(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; - expect(err.retryable).to.be["true"]; + expect(err).to.not.be['null']; + expect(err.retryable).to.be['true']; expect(spy.calls.length).to.equal(options.maxRetries + 1); return done(); }); @@ -1582,8 +1582,8 @@ }; return sendRequest(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; - expect(err.retryable).to.be["true"]; + expect(err).to.not.be['null']; + expect(err.retryable).to.be['true']; expect(spy.calls.length).to.equal(options.maxRetries + 1); return done(); }); @@ -1596,8 +1596,8 @@ }; return sendRequest(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; - expect(err.retryable).to.be["false"]; + expect(err).to.not.be['null']; + expect(err.retryable).to.be['false']; expect(spy.calls.length).to.equal(1); return done(); }); @@ -1613,8 +1613,8 @@ }; return sendRequest(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; - expect(err.retryable).to.be["true"]; + expect(err).to.not.be['null']; + expect(err.retryable).to.be['true']; expect(spy.calls.length).to.equal(options.maxRetries + 1); return done(); }); @@ -1632,7 +1632,7 @@ options = {}; return sendRequest(function(err, data) { expect(data).to.be.undefined; - expect(err).to.not.be["null"]; + expect(err).to.not.be['null']; expect(spy.calls.length).to.equal(1); return done(); }); diff --git a/test/xml/builder.spec.js b/test/xml/builder.spec.js index 311e55cecf..6a9fef2a63 100644 --- a/test/xml/builder.spec.js +++ b/test/xml/builder.spec.js @@ -41,7 +41,7 @@ Name: 'abc', State: 'Enabled' }; - xml = "\n abc\n Enabled\n"; + xml = '\n abc\n Enabled\n'; return matchXML(toXML(rules, params), xml); }); it('ignores null input', function() { @@ -76,7 +76,7 @@ State: null } }; - xml = "\n \n"; + xml = '\n \n'; return matchXML(toXML(rules, params), xml); }); it('orders xml members by the order they appear in the rules', function() { @@ -94,7 +94,7 @@ State: 'Disabled', Count: 123 }; - xml = "\n 123\n Disabled\n"; + xml = '\n 123\n Disabled\n'; return matchXML(toXML(rules, params), xml); }); it('can serializes structures into XML', function() { @@ -118,7 +118,7 @@ }, Name: 'john' }; - xml = "\n john\n
\n abc\n xyz\n
\n
"; + xml = '\n john\n
\n abc\n xyz\n
\n
'; return matchXML(toXML(rules, params), xml); }); it('serializes empty structures as empty element', function() { @@ -137,7 +137,7 @@ params = { Config: {} }; - xml = "\n \n"; + xml = '\n \n'; return matchXML(toXML(rules, params), xml); }); return it('does not serialize missing members', function() { @@ -158,7 +158,7 @@ Foo: 'abc' } }; - xml = "\n \n abc\n \n"; + xml = '\n \n abc\n \n'; return matchXML(toXML(rules, params), xml); }); }); @@ -176,7 +176,7 @@ params = { Aliases: ['abc', 'mno', 'xyz'] }; - xml = "\n \n abc\n mno\n xyz\n \n"; + xml = '\n \n abc\n mno\n xyz\n \n'; return matchXML(toXML(rules, params), xml); }); it('serializes lists (custom member names)', function() { @@ -194,7 +194,7 @@ params = { Aliases: ['abc', 'mno', 'xyz'] }; - xml = "\n \n abc\n mno\n xyz\n \n"; + xml = '\n \n abc\n mno\n xyz\n \n'; return matchXML(toXML(rules, params), xml); }); it('includes lists elements even if they have no members', function() { @@ -212,7 +212,7 @@ params = { Aliases: [] }; - xml = "\n \n"; + xml = '\n \n'; return matchXML(toXML(rules, params), xml); }); return it('serializes lists of structures', function() { @@ -247,7 +247,7 @@ } ] }; - xml = "\n \n \n 1.2\n 2.1\n \n \n 3.4\n 4.3\n \n \n"; + xml = '\n \n \n 1.2\n 2.1\n \n \n 3.4\n 4.3\n \n \n'; return matchXML(toXML(rules, params), xml); }); }); @@ -266,7 +266,7 @@ params = { Aliases: ['abc', 'mno', 'xyz'] }; - xml = "\n abc\n mno\n xyz\n"; + xml = '\n abc\n mno\n xyz\n'; return matchXML(toXML(rules, params), xml); }); it('serializes lists (custom member names)', function() { @@ -285,7 +285,7 @@ params = { Aliases: ['abc', 'mno', 'xyz'] }; - xml = "\n abc\n mno\n xyz\n"; + xml = '\n abc\n mno\n xyz\n'; return matchXML(toXML(rules, params), xml); }); it('omits lists elements when no members are given', function() { @@ -341,7 +341,7 @@ } ] }; - xml = "\n \n 1.2\n 2.1\n \n \n 3.4\n 4.3\n \n"; + xml = '\n \n 1.2\n 2.1\n \n \n 3.4\n 4.3\n \n'; return matchXML(toXML(rules, params), xml); }); }); @@ -369,7 +369,7 @@ B: 'b' } }; - xml = "\n \n \n A\n a\n \n \n B\n b\n \n \n"; + xml = '\n \n \n A\n a\n \n \n B\n b\n \n \n'; return matchXML(toXML(rules, params), xml); }); it('allows renamed map keys and values', function() { @@ -396,7 +396,7 @@ } } }; - xml = "\n \n \n A\n a\n \n \n B\n b\n \n \n"; + xml = '\n \n \n A\n a\n \n \n B\n b\n \n \n'; return matchXML(toXML(otherRules, params), xml); }); it('ignores null', function() { @@ -436,7 +436,7 @@ B: 'b' } }; - xml = "\n \n A\n a\n \n \n B\n b\n \n"; + xml = '\n \n A\n a\n \n \n B\n b\n \n'; return matchXML(toXML(rules, params), xml); }); it('allows renamed map keys and values', function() { @@ -465,7 +465,7 @@ } } }; - xml = "\n \n A\n a\n \n \n B\n b\n \n"; + xml = '\n \n A\n a\n \n \n B\n b\n \n'; return matchXML(toXML(otherRules, params), xml); }); it('ignores null', function() { @@ -492,7 +492,7 @@ params = { Count: 123.0 }; - xml = "\n 123\n"; + xml = '\n 123\n'; return matchXML(toXML(rules, params), xml); }); it('floats', function() { @@ -507,7 +507,7 @@ params = { Count: 123.123 }; - xml = "\n 123.123\n"; + xml = '\n 123.123\n'; return matchXML(toXML(rules, params), xml); }); return it('ints and floats formatted as numbers', function() { @@ -526,7 +526,7 @@ CountI: '123', CountF: '1.23' }; - xml = "\n 123\n 1.23\n"; + xml = '\n 123\n 1.23\n'; return matchXML(toXML(rules, params), xml); }); }); @@ -543,7 +543,7 @@ params = { Enabled: true }; - xml = "\n true\n"; + xml = '\n true\n'; return matchXML(toXML(rules, params), xml); }); return it('false', function() { @@ -558,7 +558,7 @@ params = { Enabled: false }; - xml = "\n false\n"; + xml = '\n false\n'; return matchXML(toXML(rules, params), xml); }); }); @@ -579,7 +579,7 @@ params = { Expires: time }; - xml = "\n " + (AWS.util.date.iso8601(time)) + "\n"; + xml = '\n ' + (AWS.util.date.iso8601(time)) + '\n'; return matchXML(toXML(rules, params), xml); }); it('rfc822', function() { @@ -595,7 +595,7 @@ params = { Expires: time }; - xml = "\n " + (AWS.util.date.rfc822(time)) + "\n"; + xml = '\n ' + (AWS.util.date.rfc822(time)) + '\n'; return matchXML(toXML(rules, params), xml); }); it('unix timestamp', function() { @@ -611,7 +611,7 @@ params = { Expires: time }; - xml = "\n " + (AWS.util.date.unixTimestamp(time)) + "\n"; + xml = '\n ' + (AWS.util.date.unixTimestamp(time)) + '\n'; return matchXML(toXML(rules, params), xml); }); return it('follows the forat given on the shape', function() { @@ -627,7 +627,7 @@ params = { Expires: time }; - xml = "\n " + (AWS.util.date.rfc822(time)) + "\n"; + xml = '\n ' + (AWS.util.date.rfc822(time)) + '\n'; return matchXML(toXML(rules, params), xml); }); }); @@ -657,7 +657,7 @@ Attr: 'abc' } }; - xml = "\n bar\n"; + xml = '\n bar\n'; return matchXML(toXML(rules, params), xml); }); }); @@ -684,7 +684,7 @@ Foo: 'bar' } }; - xml = "\n bar\n"; + xml = '\n bar\n'; return matchXML(toXML(rules, params), xml); }); it('applies namespace prefixes to the xmlns attribute', function() { @@ -710,7 +710,7 @@ Foo: 'bar' } }; - xml = "\n bar\n"; + xml = '\n bar\n'; return matchXML(toXML(rules, params), xml); }); return it('can apply namespaces to elements that have other attributes', function() { @@ -742,7 +742,7 @@ Bar: 'xyz' } }; - xml = "\n abc\n"; + xml = '\n abc\n'; return matchXML(toXML(rules, params), xml); }); }); diff --git a/test/xml/escape-attribute.spec.js b/test/xml/escape-attribute.spec.js index 7d63408bba..0ac3c46c07 100644 --- a/test/xml/escape-attribute.spec.js +++ b/test/xml/escape-attribute.spec.js @@ -5,4 +5,4 @@ describe('escape-attribute', function() { var value = 'abc 123 &<>"%\''; expect(escapeAttribute(value)).to.equal('abc 123 &<>"%''); }); -}); \ No newline at end of file +}); diff --git a/test/xml/escape-element.spec.js b/test/xml/escape-element.spec.js index 8ef406880e..54ae2d0178 100644 --- a/test/xml/escape-element.spec.js +++ b/test/xml/escape-element.spec.js @@ -5,4 +5,4 @@ describe('escape-element', function() { var value = 'abc 123 &<>"%'; expect(escapeElement(value)).to.equal('abc 123 &<>"%'); }); -}); \ No newline at end of file +}); diff --git a/test/xml/parser.spec.js b/test/xml/parser.spec.js index 301e847c80..c07865f19d 100644 --- a/test/xml/parser.spec.js +++ b/test/xml/parser.spec.js @@ -215,7 +215,7 @@ }); it('Converts xml lists of strings into arrays of strings', function() { var rules, xml; - xml = "\n \n abc\n xyz\n \n"; + xml = '\n \n abc\n xyz\n \n'; rules = { type: 'structure', members: { @@ -233,7 +233,7 @@ }); it('observes list member names when present', function() { var rules, xml; - xml = "\n \n abc\n xyz\n \n"; + xml = '\n \n abc\n xyz\n \n'; rules = { type: 'structure', members: { @@ -253,7 +253,7 @@ }); it('can parse lists of strucures', function() { var rules, xml; - xml = "\n \n abc>\n xyz>\n \n"; + xml = '\n \n abc>\n xyz>\n \n'; rules = { type: 'structure', members: { @@ -284,7 +284,7 @@ }); return it('can parse lists of strucures with renames', function() { var rules, xml; - xml = "\n \n abc>\n xyz>\n \n"; + xml = '\n \n abc>\n xyz>\n \n'; rules = { type: 'structure', members: { @@ -317,7 +317,7 @@ }); describe('flattened lists', function() { var xml; - xml = "\n \n Unknown\n John Doe\n Jane Doe\n \n"; + xml = '\n \n Unknown\n John Doe\n Jane Doe\n \n'; it('collects sibling elements of the same name', function() { var rules; rules = { @@ -349,7 +349,7 @@ }); it('flattened lists can be composed of complex obects', function() { var rules, values; - xml = "\n Name\n \n 1\n 2\n \n \n 3\n 4\n \n"; + xml = '\n Name\n \n 1\n 2\n \n \n 3\n 4\n \n'; rules = { type: 'structure', members: { @@ -392,7 +392,7 @@ }); return it('can parse flattened lists of complex objects', function() { var rules; - xml = "\n 2\n abc\n xyz\n"; + xml = '\n 2\n abc\n xyz\n'; rules = { type: 'structure', members: { @@ -430,7 +430,7 @@ describe('non-flattened', function() { it('returns empty maps as {}', function() { var rules, xml; - xml = "\n \n"; + xml = '\n \n'; rules = { type: 'structure', members: { @@ -499,7 +499,7 @@ it('expects entry, key, and value elements by default', function() { var rules, xml; - xml = "\n \n \n Groups\n 31\n \n \n GroupsQuota\n 50\n \n \n UsersQuota\n 150\n \n \n"; + xml = '\n \n \n Groups\n 31\n \n \n GroupsQuota\n 50\n \n \n UsersQuota\n 150\n \n \n'; rules = { type: 'structure', members: { @@ -523,7 +523,7 @@ }); return it('can use alternate names for key and value elements', function() { var rules, xml; - xml = "\n \n \n Groups\n 31\n \n \n GroupsQuota\n 50\n \n \n UsersQuota\n 150\n \n \n"; + xml = '\n \n \n Groups\n 31\n \n \n GroupsQuota\n 50\n \n \n UsersQuota\n 150\n \n \n'; rules = { type: 'structure', members: { @@ -554,7 +554,7 @@ return describe('flattened', function() { it('expects key and value elements by default', function() { var rules, xml; - xml = "\n \n color\n red\n \n \n size\n large\n \n"; + xml = '\n \n color\n red\n \n \n size\n large\n \n'; rules = { type: 'structure', members: { @@ -575,7 +575,7 @@ }); return it('can use alternate names for key and value elements', function() { var rules, xml; - xml = "\n \n age\n 35\n \n \n height\n 72\n \n"; + xml = '\n \n age\n 35\n \n \n height\n 72\n \n'; rules = { type: 'structure', members: { @@ -616,7 +616,7 @@ }; it('converts the string "true" in to the boolean value true', function() { var xml; - xml = "true"; + xml = 'true'; return parse(xml, rules, function(data) { return expect(data).to.eql({ enabled: true @@ -625,7 +625,7 @@ }); it('converts the string "false" in to the boolean value false', function() { var xml; - xml = "false"; + xml = 'false'; return parse(xml, rules, function(data) { return expect(data).to.eql({ enabled: false @@ -634,7 +634,7 @@ }); return it('converts the empty elements into null', function() { var xml; - xml = ""; + xml = ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ enabled: null @@ -654,7 +654,7 @@ }; it('returns an empty element as null', function() { var xml; - xml = ""; + xml = ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ CreatedAt: null @@ -665,7 +665,7 @@ var date, timestamp, xml; timestamp = 1349908100; date = new Date(timestamp * 1000); - xml = "" + timestamp + ""; + xml = '' + timestamp + ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ CreatedAt: date @@ -676,7 +676,7 @@ var date, timestamp, xml; timestamp = '2012-10-10T15:47:10.001Z'; date = new Date(timestamp); - xml = "" + timestamp + ""; + xml = '' + timestamp + ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ CreatedAt: date @@ -687,7 +687,7 @@ var date, timestamp, xml; timestamp = 'Wed, 10 Oct 2012 15:59:55 UTC'; date = new Date(timestamp); - xml = "" + timestamp + ""; + xml = '' + timestamp + ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ CreatedAt: date @@ -697,7 +697,7 @@ return it('throws an error when unable to determine the format', function() { var e, error, message, timestamp, xml; timestamp = 'bad-date-format'; - xml = "" + timestamp + ""; + xml = '' + timestamp + ''; message = 'unhandled timestamp format: ' + timestamp; error = {}; try { @@ -721,7 +721,7 @@ }; it('float parses elements types as integer', function() { var xml; - xml = "123.456"; + xml = '123.456'; return parse(xml, rules, function(data) { return expect(data).to.eql({ decimal: 123.456 @@ -730,7 +730,7 @@ }); return it('returns null for empty elements', function() { var xml; - xml = ""; + xml = ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ decimal: null @@ -750,7 +750,7 @@ }; it('integer parses elements types as integer', function() { var xml; - xml = "123"; + xml = '123'; return parse(xml, rules, function(data) { return expect(data).to.eql({ count: 123 @@ -759,7 +759,7 @@ }); return it('returns null for empty elements', function() { var xml; - xml = ""; + xml = ''; return parse(xml, rules, function(data) { return expect(data).to.eql({ count: null @@ -778,7 +778,7 @@ } } }; - xml = "John Doe"; + xml = 'John Doe'; return parse(xml, rules, function(data) { return expect(data).to.eql({ aka: 'John Doe' @@ -800,7 +800,7 @@ } } }; - xml = "JoeJohn Doe"; + xml = 'JoeJohn Doe'; return parse(xml, rules, function(data) { return expect(data).to.eql({ person: { @@ -822,7 +822,7 @@ } } }; - xml = ""; + xml = ''; return parse(xml, rules, function(data) { return expect(data.Value).to.equal(''); }); @@ -839,7 +839,7 @@ } } }; - xml = "\n Zm9v\n"; + xml = '\n Zm9v\n'; parse(xml, rules, function(data) { return expect(data.Value.toString()).to.equal('foo'); }); @@ -849,7 +849,7 @@ Value: {} } }; - xml = "\n Zm9v\n"; + xml = '\n Zm9v\n'; return parse(xml, rules, function(data) { return expect(data.Value.toString()).to.equal('foo'); }); @@ -878,7 +878,7 @@ } } }; - xml = "\n \n \n abc\n bar\n \n \n"; + xml = '\n \n \n abc\n bar\n \n \n'; return parse(xml, rules, function(data) { return expect(data).to.eql({ List: [ @@ -931,7 +931,7 @@ e = error1; error = e; } - return expect(error.retryable).to.be["true"]; + return expect(error.retryable).to.be['true']; }); }); diff --git a/test/xml/xml-node.spec.js b/test/xml/xml-node.spec.js index 396e85e508..cbe1ef62af 100644 --- a/test/xml/xml-node.spec.js +++ b/test/xml/xml-node.spec.js @@ -131,4 +131,4 @@ describe('XmlNode', function() { expect(node.removeAttribute('foo')).to.equal(node); }); }); -}); \ No newline at end of file +}); diff --git a/test/xml/xml-text.spec.js b/test/xml/xml-text.spec.js index e337dadeef..a1e7dae952 100644 --- a/test/xml/xml-text.spec.js +++ b/test/xml/xml-text.spec.js @@ -5,4 +5,4 @@ describe('XmlText', function() { var text = new XmlText('this & that are < or > "most"'); expect(text.toString()).to.equal('this & that are < or > "most"'); }); -}); \ No newline at end of file +});