diff --git a/.eslintrc.js b/.eslintrc.js index f9e49b1e55..6d8aa70f17 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,292 +1,251 @@ module.exports = { - "env": { - "node": true, - "es6": true - }, - "extends": "eslint:recommended", - "rules": { - "accessor-pairs": "error", - "array-bracket-spacing": [ - "error", - "never" - ], - "array-callback-return": "off", - "arrow-body-style": "error", - "arrow-parens": "error", - "arrow-spacing": "error", - "block-scoped-var": "off", - "block-spacing": "off", - "brace-style": [ - "error", - "1tbs", - { - "allowSingleLine": true - } - ], - "camelcase": [ - "error", - { - "properties": "never" - } - ], - "capitalized-comments": "off", - "class-methods-use-this": "error", - "comma-dangle": "off", - "comma-spacing": "off", - "comma-style": [ - "error", - "last" - ], - "complexity": "error", - "computed-property-spacing": [ - "error", - "never" - ], - "consistent-return": "off", - "consistent-this": "off", - "curly": "error", - "default-case": "off", - "dot-location": [ - "error", - "property" - ], - "dot-notation": "error", - "eol-last": "error", - "eqeqeq": "off", - "func-call-spacing": "error", - "func-name-matching": "error", - "func-names": "off", - "func-style": [ - "error", - "declaration" - ], - "generator-star-spacing": "error", - "global-require": "off", - "guard-for-in": "off", - "handle-callback-err": "off", - "id-blacklist": "error", - "id-length": "off", - "id-match": "error", - "indent": ["error", 2], - "init-declarations": "off", - "jsx-quotes": "error", - "key-spacing": "error", - "keyword-spacing": [ - "error", - { - "after": true, - "before": true - } - ], - "line-comment-position": "off", - "linebreak-style": [ - "error", - "unix" - ], - "lines-around-comment": "error", - "lines-around-directive": "error", - "max-depth": "error", - "max-len": "off", - "max-lines": "off", - "max-nested-callbacks": "error", - "max-params": "off", - "max-statements": "off", - "max-statements-per-line": "off", - "multiline-ternary": "off", - "new-cap": "error", - "new-parens": "error", - "newline-after-var": "off", - "newline-before-return": "off", - "newline-per-chained-call": "off", - "no-alert": "error", - "no-array-constructor": "error", - "no-await-in-loop": "error", - "no-bitwise": "off", - "no-caller": "error", - "no-catch-shadow": "off", - "no-compare-neg-zero": "error", - "no-confusing-arrow": "error", - "no-continue": "off", - "no-div-regex": "error", - "no-duplicate-imports": "error", - "no-else-return": "off", - "no-empty-function": "off", - "no-eq-null": "off", - "no-eval": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-label": "error", - "no-extra-parens": "off", - "no-floating-decimal": "error", - "no-implicit-globals": "error", - "no-implied-eval": "error", - "no-inline-comments": "off", - "no-inner-declarations": [ - "error", - "functions" - ], - "no-invalid-this": "off", - "no-iterator": "error", - "no-label-var": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-lonely-if": "error", - "no-loop-func": "error", - "no-magic-numbers": "off", - "no-mixed-operators": "error", - "no-mixed-requires": "error", - "no-multi-assign": "off", - "no-multi-spaces": "error", - "no-multi-str": "error", - "no-multiple-empty-lines": "error", - "no-native-reassign": "error", - "no-negated-condition": "off", - "no-negated-in-lhs": "error", - "no-nested-ternary": "error", - "no-new": "error", - "no-new-func": "error", - "no-new-object": "error", - "no-new-require": "error", - "no-new-wrappers": "error", - "no-octal-escape": "error", - "no-param-reassign": "off", - "no-path-concat": "error", - "no-plusplus": [ - "error", - { - "allowForLoopAfterthoughts": true - } - ], - "no-process-env": "off", - "no-process-exit": "error", - "no-proto": "error", - "no-prototype-builtins": "off", - "no-restricted-globals": "error", - "no-restricted-imports": "error", - "no-restricted-modules": "error", - "no-restricted-properties": "error", - "no-restricted-syntax": "error", - "no-return-assign": "error", - "no-return-await": "error", - "no-script-url": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-shadow": "off", - "no-shadow-restricted-names": "error", - "no-spaced-func": "error", - "no-sync": "error", - "no-tabs": "error", - "no-template-curly-in-string": "error", - "no-ternary": "off", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-undefined": "off", - "no-underscore-dangle": "off", - "no-unmodified-loop-condition": "error", - "no-unneeded-ternary": "error", - "no-unused-expressions": "error", - "no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "no-use-before-define": "off", - "no-useless-call": "error", - "no-useless-computed-key": "error", - "no-useless-concat": "error", - "no-useless-constructor": "error", - "no-useless-escape": "off", - "no-useless-rename": "error", - "no-useless-return": "error", - "no-var": "off", - "no-void": "error", - "no-warning-comments": "error", - "no-whitespace-before-property": "error", - "no-with": "error", - "nonblock-statement-body-position": "error", - "object-curly-newline": "off", - "object-curly-spacing": [ - "error", - "never" - ], - "object-property-newline": "off", - "object-shorthand": "off", - "one-var": "off", - "one-var-declaration-per-line": "error", - "operator-assignment": [ - "error", - "always" - ], - "operator-linebreak": "off", - "padded-blocks": "off", - "prefer-arrow-callback": "off", - "prefer-const": "error", - "prefer-destructuring": [ - "error", - { - "array": false, - "object": false - } - ], - "prefer-numeric-literals": "error", - "prefer-promise-reject-errors": "error", - "prefer-reflect": "off", - "prefer-rest-params": "off", - "prefer-spread": "off", - "prefer-template": "off", - "quote-props": "off", - "quotes": [ - "error", - "single", - { - "avoidEscape": true - } - ], - "radix": "error", - "require-await": "error", - "require-jsdoc": "off", - "rest-spread-spacing": "error", - "semi": "off", - "semi-spacing": [ - "error", - { - "after": true, - "before": false - } - ], - "sort-imports": "error", - "sort-keys": "off", - "sort-vars": "error", - "space-before-blocks": "error", - "space-before-function-paren": "off", - "space-in-parens": [ - "error", - "never" - ], - "space-infix-ops": "error", - "space-unary-ops": "error", - "spaced-comment": [ - "error", - "always" - ], - "strict": "off", - "symbol-description": "error", - "template-curly-spacing": "error", - "template-tag-spacing": "error", - "unicode-bom": [ - "error", - "never" - ], - "valid-jsdoc": "off", - "vars-on-top": "off", - "wrap-iife": "error", - "wrap-regex": "off", - "yield-star-spacing": "error", - "yoda": [ - "error", - "never" - ] - } + env: { + node: true, + es6: true, + }, + rules: { + 'accessor-pairs': 'error', + 'array-bracket-spacing': ['error', 'never'], + 'array-callback-return': 'off', + 'arrow-parens': 'error', + 'arrow-spacing': 'error', + 'block-scoped-var': 'off', + 'block-spacing': 'off', + 'brace-style': [ + 'error', + '1tbs', + { + allowSingleLine: true, + }, + ], + camelcase: [ + 'error', + { + properties: 'never', + }, + ], + 'capitalized-comments': 'off', + 'class-methods-use-this': 'error', + 'comma-dangle': 'off', + 'comma-spacing': 'off', + 'comma-style': ['error', 'last'], + complexity: 'error', + 'computed-property-spacing': ['error', 'never'], + 'consistent-return': 'off', + 'consistent-this': 'off', + curly: 'error', + 'default-case': 'off', + 'dot-location': ['error', 'property'], + 'dot-notation': 'error', + 'eol-last': 'error', + eqeqeq: 'off', + 'func-call-spacing': 'error', + 'func-name-matching': 'error', + 'func-names': 'off', + 'func-style': ['error', 'declaration', {allowArrowFunctions: true}], + 'generator-star-spacing': 'error', + 'global-require': 'off', + 'guard-for-in': 'off', + 'handle-callback-err': 'off', + 'id-blacklist': 'error', + 'id-length': 'off', + 'id-match': 'error', + 'init-declarations': 'off', + 'jsx-quotes': 'error', + 'key-spacing': 'error', + 'keyword-spacing': [ + 'error', + { + after: true, + before: true, + }, + ], + 'line-comment-position': 'off', + 'linebreak-style': ['error', 'unix'], + 'lines-around-comment': 'error', + 'lines-around-directive': 'error', + 'max-depth': 'error', + 'max-len': 'off', + 'max-lines': 'off', + 'max-nested-callbacks': 'error', + 'max-params': 'off', + 'max-statements': 'off', + 'max-statements-per-line': 'off', + 'multiline-ternary': 'off', + 'new-cap': 'error', + 'new-parens': 'error', + 'newline-after-var': 'off', + 'newline-before-return': 'off', + 'newline-per-chained-call': 'off', + 'no-alert': 'error', + 'no-array-constructor': 'error', + 'no-await-in-loop': 'error', + 'no-bitwise': 'off', + 'no-caller': 'error', + 'no-catch-shadow': 'off', + 'no-compare-neg-zero': 'error', + 'no-confusing-arrow': 'error', + 'no-continue': 'off', + 'no-div-regex': 'error', + 'no-duplicate-imports': 'error', + 'no-else-return': 'off', + 'no-empty-function': 'off', + 'no-eq-null': 'off', + 'no-eval': 'error', + 'no-extend-native': 'error', + 'no-extra-bind': 'error', + 'no-extra-label': 'error', + 'no-extra-parens': 'off', + 'no-floating-decimal': 'error', + 'no-implicit-globals': 'error', + 'no-implied-eval': 'error', + 'no-inline-comments': 'off', + 'no-inner-declarations': ['error', 'functions'], + 'no-invalid-this': 'off', + 'no-iterator': 'error', + 'no-label-var': 'error', + 'no-labels': 'error', + 'no-lone-blocks': 'error', + 'no-lonely-if': 'error', + 'no-loop-func': 'error', + 'no-magic-numbers': 'off', + 'no-mixed-requires': 'error', + 'no-multi-assign': 'off', + 'no-multi-spaces': 'error', + 'no-multi-str': 'error', + 'no-multiple-empty-lines': 'error', + 'no-native-reassign': 'error', + 'no-negated-condition': 'off', + 'no-negated-in-lhs': 'error', + 'no-nested-ternary': 'error', + 'no-new': 'error', + 'no-new-func': 'error', + 'no-new-object': 'error', + 'no-new-require': 'error', + 'no-new-wrappers': 'error', + 'no-octal-escape': 'error', + 'no-param-reassign': 'off', + 'no-path-concat': 'error', + 'no-plusplus': [ + 'error', + { + allowForLoopAfterthoughts: true, + }, + ], + 'no-process-env': 'off', + 'no-process-exit': 'error', + 'no-proto': 'error', + 'no-prototype-builtins': 'off', + 'no-restricted-globals': 'error', + 'no-restricted-imports': 'error', + 'no-restricted-modules': 'error', + 'no-restricted-properties': 'error', + 'no-restricted-syntax': 'error', + 'no-return-assign': 'error', + 'no-return-await': 'error', + 'no-script-url': 'error', + 'no-self-compare': 'error', + 'no-sequences': 'error', + 'no-shadow': 'off', + 'no-shadow-restricted-names': 'error', + 'no-spaced-func': 'error', + 'no-sync': 'error', + 'no-tabs': 'error', + 'no-template-curly-in-string': 'error', + 'no-ternary': 'off', + 'no-throw-literal': 'error', + 'no-trailing-spaces': 'error', + 'no-undef-init': 'error', + 'no-undefined': 'off', + 'no-underscore-dangle': 'off', + 'no-unmodified-loop-condition': 'error', + 'no-unneeded-ternary': 'error', + 'no-unused-expressions': 'error', + 'no-unused-vars': [ + 'error', + { + args: 'none', + }, + ], + 'no-use-before-define': 'off', + 'no-useless-call': 'error', + 'no-useless-computed-key': 'error', + 'no-useless-concat': 'error', + 'no-useless-constructor': 'error', + 'no-useless-escape': 'off', + 'no-useless-rename': 'error', + 'no-useless-return': 'error', + 'no-var': 'off', + 'no-void': 'error', + 'no-warning-comments': 'error', + 'no-whitespace-before-property': 'error', + 'no-with': 'error', + 'nonblock-statement-body-position': 'error', + 'object-curly-newline': 'off', + 'object-curly-spacing': ['error', 'never'], + 'object-property-newline': 'off', + 'object-shorthand': 'off', + 'one-var': 'off', + 'one-var-declaration-per-line': 'error', + 'operator-assignment': ['error', 'always'], + 'operator-linebreak': 'off', + 'padded-blocks': 'off', + 'prefer-arrow-callback': 'off', + 'prefer-const': 'error', + 'prefer-destructuring': [ + 'error', + { + array: false, + object: false, + }, + ], + 'prefer-numeric-literals': 'error', + 'prefer-promise-reject-errors': 'error', + 'prefer-reflect': 'off', + 'prefer-rest-params': 'off', + 'prefer-spread': 'off', + 'prefer-template': 'off', + 'quote-props': 'off', + quotes: [ + 'error', + 'single', + { + avoidEscape: true, + }, + ], + radix: 'error', + 'require-await': 'error', + 'require-jsdoc': 'off', + 'rest-spread-spacing': 'error', + semi: 'off', + 'semi-spacing': [ + 'error', + { + after: true, + before: false, + }, + ], + 'sort-imports': 'error', + 'sort-keys': 'off', + 'sort-vars': 'error', + 'space-before-blocks': 'error', + 'space-before-function-paren': 'off', + 'space-in-parens': ['error', 'never'], + 'space-infix-ops': 'error', + 'space-unary-ops': 'error', + 'spaced-comment': ['error', 'always'], + strict: 'off', + 'symbol-description': 'error', + 'template-curly-spacing': 'error', + 'template-tag-spacing': 'error', + 'unicode-bom': ['error', 'never'], + 'valid-jsdoc': 'off', + 'vars-on-top': 'off', + 'wrap-regex': 'off', + 'yield-star-spacing': 'error', + yoda: ['error', 'never'], + }, + parser: 'babel-eslint', + plugins: ['prettier'], + extends: ['plugin:prettier/recommended'], }; diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..c1d1f967c6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "arrowParens": "always", + "trailingComma": "es5", + "bracketSpacing": false, + "singleQuote": true +} diff --git a/.travis.yml b/.travis.yml index e27e0be1c2..d0eae490df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,6 @@ language: node_js node_js: - - "4.0.0" - - "4" - - "5" - "6" - - "7" - "8" - "9" - "10" diff --git a/README.md b/README.md index af66e56c8f..ca885aef9c 100644 --- a/README.md +++ b/README.md @@ -30,28 +30,14 @@ The package needs to be configured with your account's secret key which is available in your [Stripe Dashboard][api-keys]. Require it with the key's value: -``` js +```js const stripe = require('stripe')('sk_test_...'); const customer = await stripe.customers.create({ - email: 'customer@example.com' + email: 'customer@example.com', }); ``` -Or with versions of Node.js prior to v7.9: - -``` js -var stripe = require('stripe')('sk_test_...'); - -stripe.customers.create( - { email: 'customer@example.com' }, - function(err, customer) { - err; // null if no error occurred - customer; // the created customer object - } -); -``` - Or using ES modules, this looks more like: ```js @@ -60,6 +46,9 @@ const stripe = Stripe('sk_test_...'); //… ``` +On older versions of Node, you can use [promises](#using-promises) +or [callbacks](#using-callbacks) instead of `async`/`await`. + ### Usage with TypeScript Stripe does not currently maintain typings for this package, but there are @@ -78,7 +67,9 @@ To use: import * as Stripe from 'stripe'; const stripe = new Stripe('sk_test_...'); -const customer: Promise = stripe.customers.create(/* ... */); +const customer: Promise< + Stripe.customers.ICustomer +> = stripe.customers.create(/* ... */); ``` ### Using Promises @@ -88,30 +79,57 @@ callback: ```js // Create a new customer and then a new charge for that customer: -stripe.customers.create({ - email: 'foo-customer@example.com' -}).then((customer) => { - return stripe.customers.createSource(customer.id, { - source: 'tok_visa' - }); -}).then((source) => { - return stripe.charges.create({ - amount: 1600, - currency: 'usd', - customer: source.customer +stripe.customers + .create({ + email: 'foo-customer@example.com', + }) + .then((customer) => { + return stripe.customers.createSource(customer.id, { + source: 'tok_visa', + }); + }) + .then((source) => { + return stripe.charges.create({ + amount: 1600, + currency: 'usd', + customer: source.customer, + }); + }) + .then((charge) => { + // New charge created on a new customer + }) + .catch((err) => { + // Deal with an error }); -}).then((charge) => { - // New charge created on a new customer -}).catch((err) => { - // Deal with an error -}); +``` + +### Using callbacks + +On versions of Node.js prior to v7.9: + +```js +var stripe = require('stripe')('sk_test_...'); + +stripe.customers.create( + { + email: 'customer@example.com', + }, + function(err, customer) { + if (err) { + // Deal with an error (will be `null` if no error occurred). + } + + // Do something with created customer object + console.log(customer.id); + } +); ``` ### Configuring Timeout Request timeout is configurable (the default is Node's default of 120 seconds): -``` js +```js stripe.setTimeout(20000); // in ms (this is 20 seconds) ``` @@ -120,15 +138,18 @@ stripe.setTimeout(20000); // in ms (this is 20 seconds) A per-request `Stripe-Account` header for use with [Stripe Connect][connect] can be added to any method: -``` js +```js // Retrieve the balance for a connected account: -stripe.balance.retrieve({ - stripe_account: 'acct_foo' -}).then((balance) => { - // The balance object for the connected account -}).catch((err) => { - // Error -}); +stripe.balance + .retrieve({ + stripe_account: 'acct_foo', + }) + .then((balance) => { + // The balance object for the connected account + }) + .catch((err) => { + // Error + }); ``` ### Configuring a Proxy @@ -136,7 +157,7 @@ stripe.balance.retrieve({ An [https-proxy-agent][https-proxy-agent] can be configured with `setHttpAgent`. -To use stripe behind a proxy you can pass to sdk: +To use stripe behind a proxy you can pass to sdk: ```js if (process.env.http_proxy) { @@ -147,7 +168,9 @@ if (process.env.http_proxy) { ### Network retries -Automatic network retries can be enabled with `setMaxNetworkRetries`. This will retry requests `n` times with exponential backoff if they fail due to an intermittent network problem. [Idempotency keys](https://stripe.com/docs/api/idempotent_requests) are added where appropriate to prevent duplication. +Automatic network retries can be enabled with `setMaxNetworkRetries`. +This will retry requests `n` times with exponential backoff if they fail due to an intermittent network problem. +[Idempotency keys](https://stripe.com/docs/api/idempotent_requests) are added where appropriate to prevent duplication. ```js // Retry a request once before giving up @@ -160,20 +183,20 @@ Some information about the response which generated a resource is available with the `lastResponse` property: ```js -charge.lastResponse.requestId // see: https://stripe.com/docs/api/node#request_ids -charge.lastResponse.statusCode +charge.lastResponse.requestId; // see: https://stripe.com/docs/api/node#request_ids +charge.lastResponse.statusCode; ``` ### `request` and `response` events -The Stripe object emits `request` and `response` events. You can use them like this: +The Stripe object emits `request` and `response` events. You can use them like this: ```js const stripe = require('stripe')('sk_test_...'); const onRequest = (request) => { // Do something. -} +}; // Add the event handler function: stripe.on('request', onRequest); @@ -183,6 +206,7 @@ stripe.off('request', onRequest); ``` #### `request` object + ```js { api_version: 'latest', @@ -194,6 +218,7 @@ stripe.off('request', onRequest); ``` #### `response` object + ```js { api_version: 'latest', @@ -209,7 +234,7 @@ stripe.off('request', onRequest); ### Webhook signing -Stripe can optionally sign the webhook events it sends to your endpoint, allowing you to validate that they were not sent by a third-party. You can read more about it [here](https://stripe.com/docs/webhooks#signatures). +Stripe can optionally sign the webhook events it sends to your endpoint, allowing you to validate that they were not sent by a third-party. You can read more about it [here](https://stripe.com/docs/webhooks#signatures). Please note that you must pass the _raw_ request body, exactly as received from Stripe, to the `constructEvent()` function; this will not work with a parsed (i.e., JSON) request body. @@ -242,7 +267,6 @@ This information is passed along when the library makes calls to the Stripe API. As of stripe-node 6.11.0, you may auto-paginate list methods. We provide a few different APIs for this to aid with a variety of node versions and styles. - #### Async iterators (`for-await-of`) If you are in a Node environment that has support for [async iteration](https://github.com/tc39/proposal-async-iteration#the-async-iteration-statement-for-await-of), @@ -269,22 +293,26 @@ await stripe.customers.list().autoPagingEach(async (customer) => { if (shouldBreak()) { return false; } -}) +}); console.log('Done iterating.'); ``` Equivalently, without `await`, you may return a Promise, which can resolve to `false` to break: ```js -stripe.customers.list().autoPagingEach((customer) => { - return doSomething(customer).then(() => { - if (shouldBreak()) { - return false; - } - }); -}).then(() => { - console.log('Done iterating.'); -}).catch(handleError); +stripe.customers + .list() + .autoPagingEach((customer) => { + return doSomething(customer).then(() => { + if (shouldBreak()) { + return false; + } + }); + }) + .then(() => { + console.log('Done iterating.'); + }) + .catch(handleError); ``` If you prefer callbacks to promises, you may also use a `next` callback and a second `onDone` callback: @@ -307,7 +335,7 @@ stripe.customers.list().autoPagingEach( console.log('Done iterating.'); } } -) +); ``` If your `onItem` function does not accept a `next` callback parameter _or_ return a Promise, @@ -322,44 +350,55 @@ to prevent runaway list growth from consuming too much memory. Returns a promise of an array of all items across pages for a list request. ```js -const allNewCustomers = await stripe.customers.list({created: {gt: lastMonth}}) +const allNewCustomers = await stripe.customers + .list({created: {gt: lastMonth}}) .autoPagingToArray({limit: 10000}); ``` ## More Information - * [REST API Version](https://github.com/stripe/stripe-node/wiki/REST-API-Version) - * [Error Handling](https://github.com/stripe/stripe-node/wiki/Error-Handling) - * [Passing Options](https://github.com/stripe/stripe-node/wiki/Passing-Options) - * [Using Stripe Connect](https://github.com/stripe/stripe-node/wiki/Using-Stripe-Connect-with-node.js) +- [REST API Version](https://github.com/stripe/stripe-node/wiki/REST-API-Version) +- [Error Handling](https://github.com/stripe/stripe-node/wiki/Error-Handling) +- [Passing Options](https://github.com/stripe/stripe-node/wiki/Passing-Options) +- [Using Stripe Connect](https://github.com/stripe/stripe-node/wiki/Using-Stripe-Connect-with-node.js) ## Development Run all tests: ```bash -$ npm install -$ npm test +$ yarn install +$ yarn test ``` +If you do not have `yarn` installed, you can get it with `npm install --global yarn`. + Run a single test suite: ```bash -$ npm run mocha -- test/Error.spec.js +$ yarn mocha test/Error.spec.js ``` Run a single test (case sensitive): ```bash -$ npm run mocha -- test/Error.spec.js --grep 'Populates with type' +$ yarn mocha test/Error.spec.js --grep 'Populates with type' ``` -If you wish, you may run tests using your Stripe *Test* API key by setting the +If you wish, you may run tests using your Stripe _Test_ API key by setting the environment variable `STRIPE_TEST_API_KEY` before running the tests: ```bash $ export STRIPE_TEST_API_KEY='sk_test....' -$ npm test +$ yarn test +``` + +Run prettier: + +Add an [editor integration](https://prettier.io/docs/en/editors.html) or: + +```bash +$ yarn fix ``` [api-keys]: https://dashboard.stripe.com/account/apikeys diff --git a/examples/webhook-signing/express.js b/examples/webhook-signing/express.js index 2c64e12012..9317c86f7d 100644 --- a/examples/webhook-signing/express.js +++ b/examples/webhook-signing/express.js @@ -14,25 +14,29 @@ const webhookSecret = process.env.WEBHOOK_SECRET; const app = express(); // Stripe requires the raw body to construct the event -app.post('/webhooks', bodyParser.raw({type: 'application/json'}), (req, res) => { - const sig = req.headers['stripe-signature']; - - let event; - - try { - event = stripe.webhooks.constructEvent(req.body, sig, webhookSecret); - } catch (err) { - // On error, return the error message - return res.status(400).send(`Webhook Error: ${err.message}`); +app.post( + '/webhooks', + bodyParser.raw({type: 'application/json'}), + (req, res) => { + const sig = req.headers['stripe-signature']; + + let event; + + try { + event = stripe.webhooks.constructEvent(req.body, sig, webhookSecret); + } catch (err) { + // On error, return the error message + return res.status(400).send(`Webhook Error: ${err.message}`); + } + + // Do something with event + console.log('Success:', event.id); + + // Return a response to acknowledge receipt of the event + res.json({received: true}); } +); - // Do something with event - console.log('Success:', event.id); - - // Return a response to acknowledge receipt of the event - res.json({received: true}); -}); - -app.listen(3000, function() { - console.log('Example app listening on port 3000!') +app.listen(3000, () => { + console.log('Example app listening on port 3000!'); }); diff --git a/lib/Error.js b/lib/Error.js index 831aaa6eca..6e5bd43e67 100644 --- a/lib/Error.js +++ b/lib/Error.js @@ -1,6 +1,6 @@ 'use strict'; -var utils = require('./utils'); +const utils = require('./utils'); module.exports = _Error; @@ -8,8 +8,8 @@ module.exports = _Error; * Generic Error klass to wrap any errors returned by stripe-node */ function _Error(raw) { - this.populate.apply(this, arguments); - this.stack = (new Error(this.message)).stack; + this.populate(...arguments); + this.stack = new Error(this.message).stack; } // Extend Native Error @@ -27,13 +27,13 @@ _Error.extend = utils.protoExtend; * Create subclass of internal Error klass * (Specifically for errors returned from Stripe's REST API) */ -var StripeError = _Error.StripeError = _Error.extend({ +const StripeError = (_Error.StripeError = _Error.extend({ type: 'StripeError', - populate: function(raw) { + populate(raw) { // Move from prototype def (so it appears in stringified obj) this.type = this.type; - this.stack = (new Error(raw.message)).stack; + this.stack = new Error(raw.message).stack; this.rawType = raw.type; this.code = raw.code; this.param = raw.param; @@ -44,35 +44,51 @@ var StripeError = _Error.StripeError = _Error.extend({ this.requestId = raw.requestId; this.statusCode = raw.statusCode; }, -}); +})); /** * Helper factory which takes raw stripe errors and outputs wrapping instances */ -StripeError.generate = function(rawStripeError) { +StripeError.generate = (rawStripeError) => { switch (rawStripeError.type) { - case 'card_error': - return new _Error.StripeCardError(rawStripeError); - case 'invalid_request_error': - return new _Error.StripeInvalidRequestError(rawStripeError); - case 'api_error': - return new _Error.StripeAPIError(rawStripeError); - case 'idempotency_error': - return new _Error.StripeIdempotencyError(rawStripeError); - case 'invalid_grant': - return new _Error.StripeInvalidGrantError(rawStripeError); + case 'card_error': + return new _Error.StripeCardError(rawStripeError); + case 'invalid_request_error': + return new _Error.StripeInvalidRequestError(rawStripeError); + case 'api_error': + return new _Error.StripeAPIError(rawStripeError); + case 'idempotency_error': + return new _Error.StripeIdempotencyError(rawStripeError); + case 'invalid_grant': + return new _Error.StripeInvalidGrantError(rawStripeError); } return new _Error('Generic', 'Unknown Error'); }; // Specific Stripe Error types: _Error.StripeCardError = StripeError.extend({type: 'StripeCardError'}); -_Error.StripeInvalidRequestError = StripeError.extend({type: 'StripeInvalidRequestError'}); +_Error.StripeInvalidRequestError = StripeError.extend({ + type: 'StripeInvalidRequestError', +}); _Error.StripeAPIError = StripeError.extend({type: 'StripeAPIError'}); -_Error.StripeAuthenticationError = StripeError.extend({type: 'StripeAuthenticationError'}); -_Error.StripePermissionError = StripeError.extend({type: 'StripePermissionError'}); -_Error.StripeRateLimitError = StripeError.extend({type: 'StripeRateLimitError'}); -_Error.StripeConnectionError = StripeError.extend({type: 'StripeConnectionError'}); -_Error.StripeSignatureVerificationError = StripeError.extend({type: 'StripeSignatureVerificationError'}); -_Error.StripeIdempotencyError = StripeError.extend({type: 'StripeIdempotencyError'}); -_Error.StripeInvalidGrantError = StripeError.extend({type: 'StripeInvalidGrantError'}); +_Error.StripeAuthenticationError = StripeError.extend({ + type: 'StripeAuthenticationError', +}); +_Error.StripePermissionError = StripeError.extend({ + type: 'StripePermissionError', +}); +_Error.StripeRateLimitError = StripeError.extend({ + type: 'StripeRateLimitError', +}); +_Error.StripeConnectionError = StripeError.extend({ + type: 'StripeConnectionError', +}); +_Error.StripeSignatureVerificationError = StripeError.extend({ + type: 'StripeSignatureVerificationError', +}); +_Error.StripeIdempotencyError = StripeError.extend({ + type: 'StripeIdempotencyError', +}); +_Error.StripeInvalidGrantError = StripeError.extend({ + type: 'StripeInvalidGrantError', +}); diff --git a/lib/MultipartDataGenerator.js b/lib/MultipartDataGenerator.js index 4225375c40..76b8cb2962 100644 --- a/lib/MultipartDataGenerator.js +++ b/lib/MultipartDataGenerator.js @@ -1,19 +1,21 @@ 'use strict'; -var Buffer = require('safe-buffer').Buffer; -var utils = require('./utils'); +const Buffer = require('safe-buffer').Buffer; +const utils = require('./utils'); // Method for formatting HTTP body for the multipart/form-data specification // Mostly taken from Fermata.js // https://github.com/natevw/fermata/blob/5d9732a33d776ce925013a265935facd1626cc88/fermata.js#L315-L343 function multipartDataGenerator(method, data, headers) { - var segno = (Math.round(Math.random() * 1e16) + Math.round(Math.random() * 1e16)).toString(); - headers['Content-Type'] = ('multipart/form-data; boundary=' + segno); - var buffer = Buffer.alloc(0); + const segno = ( + Math.round(Math.random() * 1e16) + Math.round(Math.random() * 1e16) + ).toString(); + headers['Content-Type'] = `multipart/form-data; boundary=${segno}`; + let buffer = Buffer.alloc(0); function push(l) { - var prevBuffer = buffer; - var newBuffer = (l instanceof Buffer) ? l : Buffer.from(l); + const prevBuffer = buffer; + const newBuffer = l instanceof Buffer ? l : Buffer.from(l); buffer = Buffer.alloc(prevBuffer.length + newBuffer.length + 2); prevBuffer.copy(buffer); newBuffer.copy(buffer, prevBuffer.length); @@ -21,24 +23,28 @@ function multipartDataGenerator(method, data, headers) { } function q(s) { - return '"' + s.replace(/"|"/g, '%22').replace(/\r\n|\r|\n/g, ' ') + '"'; + return `"${s.replace(/"|"/g, '%22').replace(/\r\n|\r|\n/g, ' ')}"`; } - for (var k in utils.flattenAndStringify(data)) { - var v = data[k]; - push('--' + segno); + for (const k in utils.flattenAndStringify(data)) { + const v = data[k]; + push(`--${segno}`); if (v.hasOwnProperty('data')) { - push('Content-Disposition: form-data; name=' + q(k) + '; filename=' + q(v.name || 'blob')); - push('Content-Type: ' + (v.type || 'application/octet-stream')); + push( + `Content-Disposition: form-data; name=${q(k)}; filename=${q( + v.name || 'blob' + )}` + ); + push(`Content-Type: ${v.type || 'application/octet-stream'}`); push(''); push(v.data); } else { - push('Content-Disposition: form-data; name=' + q(k)); + push(`Content-Disposition: form-data; name=${q(k)}`); push(''); push(v); } } - push('--' + segno + '--'); + push(`--${segno}--`); return buffer; } diff --git a/lib/ResourceNamespace.js b/lib/ResourceNamespace.js index 872b9c4664..0d76787d81 100644 --- a/lib/ResourceNamespace.js +++ b/lib/ResourceNamespace.js @@ -4,17 +4,17 @@ // It also works recursively, so you could do i.e. `stripe.billing.invoicing.pay`. function ResourceNamespace(stripe, resources) { - for (var name in resources) { - var camelCaseName = name[0].toLowerCase() + name.substring(1); + for (const name in resources) { + const camelCaseName = name[0].toLowerCase() + name.substring(1); - var resource = new resources[name](stripe); + const resource = new resources[name](stripe); this[camelCaseName] = resource; } } module.exports = function(namespace, resources) { - return function (stripe) { + return function(stripe) { return new ResourceNamespace(stripe, resources); }; }; diff --git a/lib/StripeMethod.basic.js b/lib/StripeMethod.basic.js index cef6d8d597..1db6b8efbf 100644 --- a/lib/StripeMethod.basic.js +++ b/lib/StripeMethod.basic.js @@ -1,11 +1,10 @@ 'use strict'; -var isPlainObject = require('lodash.isplainobject'); -var stripeMethod = require('./StripeMethod'); -var utils = require('./utils'); +const isPlainObject = require('lodash.isplainobject'); +const stripeMethod = require('./StripeMethod'); +const utils = require('./utils'); module.exports = { - create: stripeMethod({ method: 'POST', }), @@ -34,12 +33,12 @@ module.exports = { urlParams: ['id'], }), - setMetadata: function(id, key, value, auth, cb) { - var self = this; - var data = key; - var isObject = isPlainObject(key); + setMetadata(id, key, value, auth, cb) { + const self = this; + const data = key; + const isObject = isPlainObject(key); // We assume null for an empty object - var isNull = data === null || (isObject && !Object.keys(data).length); + const isNull = data === null || (isObject && !Object.keys(data).length); // Allow optional passing of auth & cb: if ((isNull || isObject) && typeof value == 'string') { @@ -51,62 +50,79 @@ module.exports = { auth = null; } - var urlData = this.createUrlData(); - var path = this.createFullPath('/' + id, urlData); - - return utils.callbackifyPromiseWithTimeout(new Promise((function(resolve, reject) { - if (isNull) { - // Reset metadata: - sendMetadata(null, auth); - } else if (!isObject) { - // Set individual metadata property: - var metadata = {}; - metadata[key] = value; - sendMetadata(metadata, auth); - } else { - // Set entire metadata object after resetting it: - this._request('POST', null, path, { - metadata: null, - }, auth, {}, function(err, response) { - if (err) { - return reject(err); - } - sendMetadata(data, auth); - }); - } + const urlData = this.createUrlData(); + const path = this.createFullPath(`/${id}`, urlData); + + return utils.callbackifyPromiseWithTimeout( + new Promise((resolve, reject) => { + if (isNull) { + // Reset metadata: + sendMetadata(null, auth); + } else if (!isObject) { + // Set individual metadata property: + const metadata = {}; + metadata[key] = value; + sendMetadata(metadata, auth); + } else { + // Set entire metadata object after resetting it: + this._request( + 'POST', + null, + path, + {metadata: null}, + auth, + {}, + (err, response) => { + if (err) { + return reject(err); + } + sendMetadata(data, auth); + } + ); + } - function sendMetadata(metadata, auth) { - self._request('POST', null, path, { - metadata: metadata, - }, auth, {}, function(err, response) { - if (err) { - reject(err); - } else { - resolve(response.metadata); - } - }); - } - }).bind(this)), cb); + function sendMetadata(metadata, auth) { + self._request( + 'POST', + null, + path, + {metadata}, + auth, + {}, + (err, response) => { + if (err) { + reject(err); + } else { + resolve(response.metadata); + } + } + ); + } + }), + cb + ); }, - getMetadata: function(id, auth, cb) { + getMetadata(id, auth, cb) { if (!cb && typeof auth == 'function') { cb = auth; auth = null; } - var urlData = this.createUrlData(); - var path = this.createFullPath('/' + id, urlData); + const urlData = this.createUrlData(); + const path = this.createFullPath(`/${id}`, urlData); - return utils.callbackifyPromiseWithTimeout(new Promise((function(resolve, reject) { - this._request('GET', null, path, {}, auth, {}, function(err, response) { - if (err) { - reject(err); - } else { - resolve(response.metadata); - } - }); - }).bind(this)), cb); + return utils.callbackifyPromiseWithTimeout( + new Promise((resolve, reject) => { + this._request('GET', null, path, {}, auth, {}, (err, response) => { + if (err) { + reject(err); + } else { + resolve(response.metadata); + } + }); + }), + cb + ); }, - }; diff --git a/lib/StripeMethod.js b/lib/StripeMethod.js index 74bdfae7d5..c1f639fc74 100644 --- a/lib/StripeMethod.js +++ b/lib/StripeMethod.js @@ -1,8 +1,9 @@ 'use strict'; -var utils = require('./utils'); -var makeRequest = require('./makeRequest'); -var makeAutoPaginationMethods = require('./autoPagination').makeAutoPaginationMethods; +const utils = require('./utils'); +const makeRequest = require('./makeRequest'); +const makeAutoPaginationMethods = require('./autoPagination') + .makeAutoPaginationMethods; /** * Create an API method from the declared spec. @@ -19,16 +20,21 @@ var makeAutoPaginationMethods = require('./autoPagination').makeAutoPaginationMe * @param [spec.host] Hostname for the request. */ function stripeMethod(spec) { - return function() { - var self = this; - var args = [].slice.call(arguments); + return function(...args) { + const callback = typeof args[args.length - 1] == 'function' && args.pop(); - var callback = typeof args[args.length - 1] == 'function' && args.pop(); - - var requestPromise = utils.callbackifyPromiseWithTimeout(makeRequest(self, args, spec, {}), callback) + const requestPromise = utils.callbackifyPromiseWithTimeout( + makeRequest(this, args, spec, {}), + callback + ); if (spec.methodType === 'list') { - var autoPaginationMethods = makeAutoPaginationMethods(self, args, spec, requestPromise); + const autoPaginationMethods = makeAutoPaginationMethods( + this, + args, + spec, + requestPromise + ); Object.assign(requestPromise, autoPaginationMethods); } diff --git a/lib/StripeResource.js b/lib/StripeResource.js index bea29419ea..2c7d35b35e 100644 --- a/lib/StripeResource.js +++ b/lib/StripeResource.js @@ -1,17 +1,17 @@ 'use strict'; -var http = require('http'); -var https = require('https'); -var path = require('path'); -var uuid = require('uuid/v4'); +const http = require('http'); +const https = require('https'); +const path = require('path'); +const uuid = require('uuid/v4'); -var utils = require('./utils'); -var Error = require('./Error'); +const utils = require('./utils'); +const Error = require('./Error'); -var hasOwn = {}.hasOwnProperty; +const hasOwn = {}.hasOwnProperty; -var defaultHttpAgent = new http.Agent({keepAlive: true}); -var defaultHttpsAgent = new https.Agent({keepAlive: true}); +const defaultHttpAgent = new http.Agent({keepAlive: true}); +const defaultHttpsAgent = new https.Agent({keepAlive: true}); // Provide extension mechanism for Stripe Resource Sub-Classes StripeResource.extend = utils.protoExtend; @@ -29,7 +29,9 @@ function StripeResource(stripe, urlData) { this._stripe = stripe; this._urlData = urlData || {}; - this.basePath = utils.makeURLInterpolator(this.basePath || stripe.getApiField('basePath')); + this.basePath = utils.makeURLInterpolator( + this.basePath || stripe.getApiField('basePath') + ); this.resourcePath = this.path; this.path = utils.makeURLInterpolator(this.path); @@ -39,17 +41,16 @@ function StripeResource(stripe, urlData) { }, this); } - this.initialize.apply(this, arguments); + this.initialize(...arguments); } StripeResource.prototype = { - path: '', // Methods that don't use the API's default '/v1' path can override it with this setting. basePath: null, - initialize: function() {}, + initialize() {}, // Function to override the default data processor. This allows full control // over how a StripeResource's request data will get converted into an HTTP @@ -61,29 +62,29 @@ StripeResource.prototype = { // be thrown, and they will be passed to the callback/promise. validateRequest: null, - createFullPath: function(commandPath, urlData) { - return path.join( - this.basePath(urlData), - this.path(urlData), - typeof commandPath == 'function' ? - commandPath(urlData) : commandPath - ).replace(/\\/g, '/'); // ugly workaround for Windows + createFullPath(commandPath, urlData) { + return path + .join( + this.basePath(urlData), + this.path(urlData), + typeof commandPath == 'function' ? commandPath(urlData) : commandPath + ) + .replace(/\\/g, '/'); // ugly workaround for Windows }, // Creates a relative resource path with symbols left in (unlike // createFullPath which takes some data to replace them with). For example it // might produce: /invoices/{id} - createResourcePathWithSymbols: function(pathWithSymbols) { - return '/' + path.join( - this.resourcePath, - pathWithSymbols || '' - ).replace(/\\/g, '/'); // ugly workaround for Windows + createResourcePathWithSymbols(pathWithSymbols) { + return `/${path + .join(this.resourcePath, pathWithSymbols || '') + .replace(/\\/g, '/')}`; // ugly workaround for Windows }, - createUrlData: function() { - var urlData = {}; + createUrlData() { + const urlData = {}; // Merge in baseData - for (var i in this._urlData) { + for (const i in this._urlData) { if (hasOwn.call(this._urlData, i)) { urlData[i] = this._urlData[i]; } @@ -94,46 +95,44 @@ StripeResource.prototype = { // DEPRECATED: Here for backcompat in case users relied on this. wrapTimeout: utils.callbackifyPromiseWithTimeout, - _timeoutHandler: function(timeout, req, callback) { - var self = this; - return function() { - var timeoutErr = new Error('ETIMEDOUT'); + _timeoutHandler(timeout, req, callback) { + return () => { + const timeoutErr = new Error('ETIMEDOUT'); timeoutErr.code = 'ETIMEDOUT'; req._isAborted = true; req.abort(); callback.call( - self, + this, new Error.StripeConnectionError({ - message: 'Request aborted due to timeout being reached (' + timeout + 'ms)', + message: `Request aborted due to timeout being reached (${timeout}ms)`, detail: timeoutErr, }), null ); - } + }; }, - _responseHandler: function(req, callback) { - var self = this; - return function(res) { - var response = ''; + _responseHandler(req, callback) { + return (res) => { + let response = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { + res.on('data', (chunk) => { response += chunk; }); - res.on('end', function() { - var headers = res.headers || {}; + res.on('end', () => { + const headers = res.headers || {}; // NOTE: Stripe responds with lowercase header names/keys. // For convenience, make Request-Id easily accessible on // lastResponse. res.requestId = headers['request-id']; - var requestDurationMs = Date.now() - req._requestStart; + const requestDurationMs = Date.now() - req._requestStart; - var responseEvent = utils.removeEmpty({ + const responseEvent = utils.removeEmpty({ api_version: headers['stripe-version'], account: headers['stripe-account'], idempotency_key: headers['idempotency-key'], @@ -144,21 +143,21 @@ StripeResource.prototype = { elapsed: requestDurationMs, }); - self._stripe._emitter.emit('response', responseEvent); + this._stripe._emitter.emit('response', responseEvent); try { response = JSON.parse(response); if (response.error) { - var err; + let err; // Convert OAuth error responses into a standard format // so that the rest of the error logic can be shared if (typeof response.error === 'string') { response.error = { type: response.error, - message: response.error_description - } + message: response.error_description, + }; } response.error.headers = headers; @@ -174,14 +173,14 @@ StripeResource.prototype = { } else { err = Error.StripeError.generate(response.error); } - return callback.call(self, err, null); + return callback.call(this, err, null); } } catch (e) { return callback.call( - self, + this, new Error.StripeAPIError({ message: 'Invalid JSON received from the Stripe API', - response: response, + response, exception: e, requestId: headers['request-id'], }), @@ -189,7 +188,7 @@ StripeResource.prototype = { ); } - self._recordRequestMetrics(res.requestId, requestDurationMs); + this._recordRequestMetrics(res.requestId, requestDurationMs); // Expose res object Object.defineProperty(response, 'lastResponse', { @@ -197,34 +196,35 @@ StripeResource.prototype = { writable: false, value: res, }); - callback.call(self, null, response); + callback.call(this, null, response); }); }; }, - _generateConnectionErrorMessage: function(requestRetries) { - return 'An error occurred with our connection to Stripe.' + (requestRetries > 0 ? ' Request was retried ' + requestRetries + ' times.' : ''); + _generateConnectionErrorMessage(requestRetries) { + return `An error occurred with our connection to Stripe.${ + requestRetries > 0 ? ` Request was retried ${requestRetries} times.` : '' + }`; }, - _errorHandler: function(req, requestRetries, callback) { - var self = this; - return function(error) { + _errorHandler(req, requestRetries, callback) { + return (error) => { if (req._isAborted) { // already handled return; } callback.call( - self, + this, new Error.StripeConnectionError({ - message: self._generateConnectionErrorMessage(requestRetries), + message: this._generateConnectionErrorMessage(requestRetries), detail: error, }), null ); - } + }; }, - _shouldRetry: function(res, numRetries) { + _shouldRetry(res, numRetries) { // Do not retry if we are out of retries. if (numRetries >= this._stripe.getMaxNetworkRetries()) { return false; @@ -249,14 +249,14 @@ StripeResource.prototype = { return false; }, - _getSleepTimeInMS: function(numRetries) { - var initialNetworkRetryDelay = this._stripe.getInitialNetworkRetryDelay(); - var maxNetworkRetryDelay = this._stripe.getMaxNetworkRetryDelay(); + _getSleepTimeInMS(numRetries) { + const initialNetworkRetryDelay = this._stripe.getInitialNetworkRetryDelay(); + const maxNetworkRetryDelay = this._stripe.getMaxNetworkRetryDelay(); // Apply exponential backoff with initialNetworkRetryDelay on the // number of numRetries so far as inputs. Do not allow the number to exceed // maxNetworkRetryDelay. - var sleepSeconds = Math.min( + let sleepSeconds = Math.min( initialNetworkRetryDelay * Math.pow(numRetries - 1, 2), maxNetworkRetryDelay ); @@ -271,19 +271,19 @@ StripeResource.prototype = { return sleepSeconds * 1000; }, - _defaultHeaders: function(auth, contentLength, apiVersion) { - var userAgentString = 'Stripe/v1 NodeBindings/' + this._stripe.getConstant('PACKAGE_VERSION'); + _defaultHeaders(auth, contentLength, apiVersion) { + let userAgentString = `Stripe/v1 NodeBindings/${this._stripe.getConstant( + 'PACKAGE_VERSION' + )}`; if (this._stripe._appInfo) { - userAgentString += ' ' + this._stripe.getAppInfoAsString(); + userAgentString += ` ${this._stripe.getAppInfoAsString()}`; } - var headers = { + const headers = { // Use specified auth token or use default from this stripe instance: - 'Authorization': auth ? - 'Bearer ' + auth : - this._stripe.getApiField('auth'), - 'Accept': 'application/json', + Authorization: auth ? `Bearer ${auth}` : this._stripe.getApiField('auth'), + Accept: 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': contentLength, 'User-Agent': userAgentString, @@ -296,140 +296,103 @@ StripeResource.prototype = { return headers; }, - _addTelemetryHeader: function(headers) { - if (this._stripe.getTelemetryEnabled() && this._stripe._prevRequestMetrics.length > 0) { - var metrics = this._stripe._prevRequestMetrics.shift(); + _addTelemetryHeader(headers) { + if ( + this._stripe.getTelemetryEnabled() && + this._stripe._prevRequestMetrics.length > 0 + ) { + const metrics = this._stripe._prevRequestMetrics.shift(); headers['X-Stripe-Client-Telemetry'] = JSON.stringify({ - 'last_request_metrics': metrics + last_request_metrics: metrics, }); } }, - _recordRequestMetrics: function(requestId, requestDurationMs) { + _recordRequestMetrics(requestId, requestDurationMs) { if (this._stripe.getTelemetryEnabled() && requestId) { - if (this._stripe._prevRequestMetrics.length > StripeResource.MAX_BUFFERED_REQUEST_METRICS) { - utils.emitWarning('Request metrics buffer is full, dropping telemetry message.'); + if ( + this._stripe._prevRequestMetrics.length > + StripeResource.MAX_BUFFERED_REQUEST_METRICS + ) { + utils.emitWarning( + 'Request metrics buffer is full, dropping telemetry message.' + ); } else { this._stripe._prevRequestMetrics.push({ - 'request_id': requestId, - 'request_duration_ms': requestDurationMs, + request_id: requestId, + request_duration_ms: requestDurationMs, }); } } }, - _request: function(method, host, path, data, auth, options, callback) { - var self = this; - var requestData; - - function makeRequestWithData(error, data) { - var apiVersion; - var headers; - - if (error) { - return callback(error); - } - - apiVersion = self._stripe.getApiField('version'); - requestData = data; - headers = self._defaultHeaders(auth, requestData.length, apiVersion); - - self._stripe.getClientUserAgent(function(cua) { - headers['X-Stripe-Client-User-Agent'] = cua; - - if (options.headers) { - Object.assign(headers, options.headers); - } - - self._addTelemetryHeader(headers); - - makeRequest(apiVersion, headers); - }); - } - - if (self.requestDataProcessor) { - self.requestDataProcessor(method, data, options.headers, makeRequestWithData); - } else { - makeRequestWithData(null, utils.stringifyRequestData(data || {})); - } - - function retryRequest(requestFn, apiVersion, headers, requestRetries) { - requestRetries += 1; + _request(method, host, path, data, auth, options, callback) { + let requestData; - return setTimeout( - requestFn, - self._getSleepTimeInMS(requestRetries), - apiVersion, - headers, - requestRetries - ); - } - - function makeRequest(apiVersion, headers, numRetries) { - var timeout = self._stripe.getApiField('timeout'); - var isInsecureConnection = self._stripe.getApiField('protocol') == 'http'; - var agent = self._stripe.getApiField('agent'); + const makeRequest = (apiVersion, headers, numRetries) => { + const timeout = this._stripe.getApiField('timeout'); + const isInsecureConnection = + this._stripe.getApiField('protocol') == 'http'; + let agent = this._stripe.getApiField('agent'); if (agent == null) { agent = isInsecureConnection ? defaultHttpAgent : defaultHttpsAgent; } - var req = ( - isInsecureConnection ? http : https - ).request({ - host: host || self._stripe.getApiField('host'), - port: self._stripe.getApiField('port'), - path: path, - method: method, - agent: agent, - headers: headers, + const req = (isInsecureConnection ? http : https).request({ + host: host || this._stripe.getApiField('host'), + port: this._stripe.getApiField('port'), + path, + method, + agent, + headers, ciphers: 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:!MD5', }); // If this is a POST and we allow multiple retries, set a idempotency key if one is not // already provided. - if (method === 'POST' && self._stripe.getMaxNetworkRetries() > 0) { + if (method === 'POST' && this._stripe.getMaxNetworkRetries() > 0) { if (!headers.hasOwnProperty('Idempotency-Key')) { headers['Idempotency-Key'] = uuid(); } } - var requestEvent = utils.removeEmpty({ + const requestEvent = utils.removeEmpty({ api_version: apiVersion, account: headers['Stripe-Account'], idempotency_key: headers['Idempotency-Key'], - method: method, - path: path, + method, + path, }); - var requestRetries = numRetries || 0; + const requestRetries = numRetries || 0; req._requestEvent = requestEvent; req._requestStart = Date.now(); - self._stripe._emitter.emit('request', requestEvent); + this._stripe._emitter.emit('request', requestEvent); - req.setTimeout(timeout, self._timeoutHandler(timeout, req, callback)); + req.setTimeout(timeout, this._timeoutHandler(timeout, req, callback)); - req.on('response', function(res) { - if (self._shouldRetry(res, requestRetries)) { + req.on('response', (res) => { + if (this._shouldRetry(res, requestRetries)) { return retryRequest(makeRequest, apiVersion, headers, requestRetries); } else { - return self._responseHandler(req, callback)(res); + return this._responseHandler(req, callback)(res); } }); - req.on('error', function(error) { - if (self._shouldRetry(null, requestRetries)) { + req.on('error', (error) => { + if (this._shouldRetry(null, requestRetries)) { return retryRequest(makeRequest, apiVersion, headers, requestRetries); } else { - return self._errorHandler(req, requestRetries, callback)(error); + return this._errorHandler(req, requestRetries, callback)(error); } }); - req.on('socket', function(socket) { + req.on('socket', (socket) => { if (socket.connecting) { - socket.on((isInsecureConnection ? 'connect' : 'secureConnect'), function() { + socket.on(isInsecureConnection ? 'connect' : 'secureConnect', () => { // Send payload; we're safe: req.write(requestData); req.end(); @@ -440,7 +403,56 @@ StripeResource.prototype = { req.end(); } }); + }; + + const makeRequestWithData = (error, data) => { + if (error) { + return callback(error); + } + + const apiVersion = this._stripe.getApiField('version'); + requestData = data; + const headers = this._defaultHeaders( + auth, + requestData.length, + apiVersion + ); + + this._stripe.getClientUserAgent((cua) => { + headers['X-Stripe-Client-User-Agent'] = cua; + + if (options.headers) { + Object.assign(headers, options.headers); + } + + this._addTelemetryHeader(headers); + + makeRequest(apiVersion, headers); + }); + }; + + if (this.requestDataProcessor) { + this.requestDataProcessor( + method, + data, + options.headers, + makeRequestWithData + ); + } else { + makeRequestWithData(null, utils.stringifyRequestData(data || {})); } + + const retryRequest = (requestFn, apiVersion, headers, requestRetries) => { + requestRetries += 1; + + return setTimeout( + requestFn, + this._getSleepTimeInMS(requestRetries), + apiVersion, + headers, + requestRetries + ); + }; }, }; diff --git a/lib/Webhooks.js b/lib/Webhooks.js index ecbe09e603..cfe16f3e84 100644 --- a/lib/Webhooks.js +++ b/lib/Webhooks.js @@ -1,43 +1,49 @@ 'use strict'; -var Buffer = require('safe-buffer').Buffer; -var crypto = require('crypto'); +const Buffer = require('safe-buffer').Buffer; +const crypto = require('crypto'); -var utils = require('./utils'); -var Error = require('./Error'); +const utils = require('./utils'); +const Error = require('./Error'); -var Webhook = { +const Webhook = { DEFAULT_TOLERANCE: 300, // 5 minutes - constructEvent: function(payload, header, secret, tolerance) { - this.signature.verifyHeader(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE); + constructEvent(payload, header, secret, tolerance) { + this.signature.verifyHeader( + payload, + header, + secret, + tolerance || Webhook.DEFAULT_TOLERANCE + ); - var jsonPayload = JSON.parse(payload); + const jsonPayload = JSON.parse(payload); return jsonPayload; }, }; -var signature = { +const signature = { EXPECTED_SCHEME: 'v1', - _computeSignature: function(payload, secret) { - return crypto.createHmac('sha256', secret) + _computeSignature: (payload, secret) => { + return crypto + .createHmac('sha256', secret) .update(payload, 'utf8') .digest('hex'); }, - verifyHeader: function(payload, header, secret, tolerance) { + verifyHeader(payload, header, secret, tolerance) { payload = Buffer.isBuffer(payload) ? payload.toString('utf8') : payload; header = Buffer.isBuffer(header) ? header.toString('utf8') : header; - var details = parseHeader(header, this.EXPECTED_SCHEME); + const details = parseHeader(header, this.EXPECTED_SCHEME); if (!details || details.timestamp === -1) { throw new Error.StripeSignatureVerificationError({ message: 'Unable to extract timestamp and signatures from header', detail: { - header: header, - payload: payload, + header, + payload, }, }); } @@ -46,38 +52,42 @@ var signature = { throw new Error.StripeSignatureVerificationError({ message: 'No signatures found with expected scheme', detail: { - header: header, - payload: payload, + header, + payload, }, }); } - var expectedSignature = this._computeSignature(details.timestamp + '.' + payload, secret); + const expectedSignature = this._computeSignature( + `${details.timestamp}.${payload}`, + secret + ); - var signatureFound = !!details.signatures - .filter(utils.secureCompare.bind(utils, expectedSignature)) - .length; + const signatureFound = !!details.signatures.filter( + utils.secureCompare.bind(utils, expectedSignature) + ).length; if (!signatureFound) { throw new Error.StripeSignatureVerificationError({ - message: 'No signatures found matching the expected signature for payload.' + + message: + 'No signatures found matching the expected signature for payload.' + ' Are you passing the raw request body you received from Stripe?' + ' https://github.com/stripe/stripe-node#webhook-signing', detail: { - header: header, - payload: payload, + header, + payload, }, }); } - var timestampAge = Math.floor(Date.now() / 1000) - details.timestamp; + const timestampAge = Math.floor(Date.now() / 1000) - details.timestamp; if (tolerance > 0 && timestampAge > tolerance) { throw new Error.StripeSignatureVerificationError({ message: 'Timestamp outside the tolerance zone', detail: { - header: header, - payload: payload, + header, + payload, }, }); } @@ -91,22 +101,25 @@ function parseHeader(header, scheme) { return null; } - return header.split(',').reduce(function(accum, item) { - var kv = item.split('='); + return header.split(',').reduce( + (accum, item) => { + const kv = item.split('='); - if (kv[0] === 't') { - accum.timestamp = kv[1]; - } + if (kv[0] === 't') { + accum.timestamp = kv[1]; + } - if (kv[0] === scheme) { - accum.signatures.push(kv[1]); - } + if (kv[0] === scheme) { + accum.signatures.push(kv[1]); + } - return accum; - }, { - timestamp: -1, - signatures: [], - }); + return accum; + }, + { + timestamp: -1, + signatures: [], + } + ); } Webhook.signature = signature; diff --git a/lib/autoPagination.js b/lib/autoPagination.js index 2a21c416c2..c3f052169b 100644 --- a/lib/autoPagination.js +++ b/lib/autoPagination.js @@ -1,34 +1,44 @@ 'use strict'; -var makeRequest = require('./makeRequest'); -var utils = require('./utils'); +const makeRequest = require('./makeRequest'); +const utils = require('./utils'); function makeAutoPaginationMethods(self, requestArgs, spec, firstPagePromise) { - var promiseCache = {currentPromise: null}; - var listPromise = firstPagePromise; - var i = 0; + const promiseCache = {currentPromise: null}; + let listPromise = firstPagePromise; + let i = 0; function iterate(listResult) { - if (!(listResult && listResult.data && typeof listResult.data.length === 'number')) { - throw Error('Unexpected: Stripe API response does not have a well-formed `data` array.'); + if ( + !( + listResult && + listResult.data && + typeof listResult.data.length === 'number' + ) + ) { + throw Error( + 'Unexpected: Stripe API response does not have a well-formed `data` array.' + ); } if (i < listResult.data.length) { - var value = listResult.data[i]; + const value = listResult.data[i]; i += 1; - return {value: value, done: false}; + return {value, done: false}; } else if (listResult.has_more) { // Reset counter, request next page, and recurse. i = 0; - var lastId = getLastId(listResult); - listPromise = makeRequest(self, requestArgs, spec, {starting_after: lastId}); + const lastId = getLastId(listResult); + listPromise = makeRequest(self, requestArgs, spec, { + starting_after: lastId, + }); return listPromise.then(iterate); } return {value: undefined, done: true}; } function asyncIteratorNext() { - return memoizedPromise(promiseCache, function(resolve, reject) { + return memoizedPromise(promiseCache, (resolve, reject) => { return listPromise .then(iterate) .then(resolve) @@ -36,22 +46,22 @@ function makeAutoPaginationMethods(self, requestArgs, spec, firstPagePromise) { }); } - var autoPagingEach = makeAutoPagingEach(asyncIteratorNext); - var autoPagingToArray = makeAutoPagingToArray(autoPagingEach); + const autoPagingEach = makeAutoPagingEach(asyncIteratorNext); + const autoPagingToArray = makeAutoPagingToArray(autoPagingEach); - var autoPaginationMethods = { - autoPagingEach: autoPagingEach, - autoPagingToArray: autoPagingToArray, + const autoPaginationMethods = { + autoPagingEach, + autoPagingToArray, // Async iterator functions: next: asyncIteratorNext, - return: function() { + return: () => { // This is required for `break`. return {}; }, - [getAsyncIteratorSymbol()]: function() { + [getAsyncIteratorSymbol()]: () => { return autoPaginationMethods; - } + }, }; return autoPaginationMethods; } @@ -76,9 +86,11 @@ function getDoneCallback(args) { if (args.length < 2) { return undefined; } - var onDone = args[1]; + const onDone = args[1]; if (typeof onDone !== 'function') { - throw Error('The second argument to autoPagingEach, if present, must be a callback function; receieved ' + typeof onDone); + throw Error( + `The second argument to autoPagingEach, if present, must be a callback function; receieved ${typeof onDone}` + ); } return onDone; } @@ -98,9 +110,11 @@ function getItemCallback(args) { if (args.length === 0) { return undefined; } - var onItem = args[0]; + const onItem = args[0]; if (typeof onItem !== 'function') { - throw Error('The first argument to autoPagingEach, if present, must be a callback function; receieved ' + typeof onItem); + throw Error( + `The first argument to autoPagingEach, if present, must be a callback function; receieved ${typeof onItem}` + ); } // 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });` @@ -109,7 +123,9 @@ function getItemCallback(args) { } if (onItem.length > 2) { - throw Error('The `onItem` callback function passed to autoPagingEach must accept at most two arguments; got ' + onItem); + throw Error( + `The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${onItem}` + ); } // This magically handles all three of these usecases (the latter two being functionally identical): @@ -117,17 +133,19 @@ function getItemCallback(args) { // 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });` // 3. `.autoPagingEach((item) => doSomething(item).then(() => false));` return function _onItem(item, next) { - var shouldContinue = onItem(item); + const shouldContinue = onItem(item); next(shouldContinue); }; } function getLastId(listResult) { - var lastIdx = listResult.data.length - 1; - var lastItem = listResult.data[lastIdx]; - var lastId = lastItem && lastItem.id; + const lastIdx = listResult.data.length - 1; + const lastItem = listResult.data[lastIdx]; + const lastId = lastItem && lastItem.id; if (!lastId) { - throw Error('Unexpected: No `id` found on the last item while auto-paging a list.'); + throw Error( + 'Unexpected: No `id` found on the last item while auto-paging a list.' + ); } return lastId; } @@ -141,7 +159,7 @@ function memoizedPromise(promiseCache, cb) { if (promiseCache.currentPromise) { return promiseCache.currentPromise; } - promiseCache.currentPromise = new Promise(cb).then(function(ret) { + promiseCache.currentPromise = new Promise(cb).then((ret) => { promiseCache.currentPromise = undefined; return ret; }); @@ -150,57 +168,66 @@ function memoizedPromise(promiseCache, cb) { function makeAutoPagingEach(asyncIteratorNext) { return function autoPagingEach(/* onItem?, onDone? */) { - var args = [].slice.call(arguments); - var onItem = getItemCallback(args); - var onDone = getDoneCallback(args); + const args = [].slice.call(arguments); + const onItem = getItemCallback(args); + const onDone = getDoneCallback(args); if (args.length > 2) { throw Error('autoPagingEach takes up to two arguments; received:', args); } - var autoPagePromise = wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem); + const autoPagePromise = wrapAsyncIteratorWithCallback( + asyncIteratorNext, + onItem + ); return utils.callbackifyPromiseWithTimeout(autoPagePromise, onDone); - } + }; } function makeAutoPagingToArray(autoPagingEach) { return function autoPagingToArray(opts, onDone) { - var limit = opts && opts.limit; + const limit = opts && opts.limit; if (!limit) { - throw Error('You must pass a `limit` option to autoPagingToArray, eg; `autoPagingToArray({limit: 1000});`.'); + throw Error( + 'You must pass a `limit` option to autoPagingToArray, eg; `autoPagingToArray({limit: 1000});`.' + ); } if (limit > 10000) { - throw Error('You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.'); + throw Error( + 'You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.' + ); } - var promise = new Promise(function(resolve, reject) { - var items = []; - autoPagingEach(function(item) { + const promise = new Promise((resolve, reject) => { + const items = []; + autoPagingEach((item) => { items.push(item); if (items.length >= limit) { return false; } - }).then(function() { - resolve(items); - }).catch(reject); + }) + .then(() => { + resolve(items); + }) + .catch(reject); }); return utils.callbackifyPromiseWithTimeout(promise, onDone); - } + }; } function wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem) { - return new Promise(function(resolve, reject) { + return new Promise((resolve, reject) => { function handleIteration(iterResult) { if (iterResult.done) { resolve(); return; } - var item = iterResult.value; - return new Promise(function(next) { + const item = iterResult.value; + return new Promise((next) => { // Bit confusing, perhaps; we pass a `resolve` fn // to the user, so they can decide when and if to continue. // They can return false, or a promise which resolves to false, to break. onItem(item, next); - }).then(function(shouldContinue) { + }).then((shouldContinue) => { if (shouldContinue === false) { return handleIteration({done: true}); } else { @@ -209,6 +236,8 @@ function wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem) { }); } - asyncIteratorNext().then(handleIteration).catch(reject); + asyncIteratorNext() + .then(handleIteration) + .catch(reject); }); } diff --git a/lib/makeRequest.js b/lib/makeRequest.js index c55ac3aaa3..cb49d4c2ed 100644 --- a/lib/makeRequest.js +++ b/lib/makeRequest.js @@ -1,39 +1,40 @@ 'use strict'; -var utils = require('./utils'); -var OPTIONAL_REGEX = /^optional!/; +const utils = require('./utils'); +const OPTIONAL_REGEX = /^optional!/; function getRequestOpts(self, requestArgs, spec, overrideData) { // Extract spec values with defaults. - var commandPath = typeof spec.path == 'function' ? spec.path - : utils.makeURLInterpolator(spec.path || ''); - var requestMethod = (spec.method || 'GET').toUpperCase(); - var urlParams = spec.urlParams || []; - var encode = spec.encode || function(data) {return data;}; - var host = spec.host; + const commandPath = + typeof spec.path == 'function' + ? spec.path + : utils.makeURLInterpolator(spec.path || ''); + const requestMethod = (spec.method || 'GET').toUpperCase(); + const urlParams = spec.urlParams || []; + const encode = spec.encode || ((data) => data); + const host = spec.host; // Don't mutate args externally. - var args = [].slice.call(requestArgs); + const args = [].slice.call(requestArgs); // Generate and validate url params. - var urlData = self.createUrlData(); - for (var i = 0, l = urlParams.length; i < l; ++i) { + const urlData = self.createUrlData(); + for (let i = 0, l = urlParams.length; i < l; ++i) { var path; // Note that we shift the args array after every iteration so this just // grabs the "next" argument for use as a URL parameter. - var arg = args[0]; + const arg = args[0]; - var param = urlParams[i]; + let param = urlParams[i]; - var isOptional = OPTIONAL_REGEX.test(param); + const isOptional = OPTIONAL_REGEX.test(param); param = param.replace(OPTIONAL_REGEX, ''); if (param == 'id' && typeof arg !== 'string') { path = self.createResourcePathWithSymbols(spec.path); throw new Error( - 'Stripe: "id" must be a string, but got: ' + typeof arg + - ' (on API request to `' + requestMethod + ' ' + path + '`)' + `Stripe: "id" must be a string, but got: ${typeof arg} (on API request to \`${requestMethod} ${path}\`)` ); } @@ -45,8 +46,9 @@ function getRequestOpts(self, requestArgs, spec, overrideData) { path = self.createResourcePathWithSymbols(spec.path); throw new Error( - 'Stripe: Argument "' + urlParams[i] + '" required, but got: ' + arg + - ' (on API request to `' + requestMethod + ' ' + path + '`)' + `Stripe: Argument "${ + urlParams[i] + }" required, but got: ${arg} (on API request to \`${requestMethod} ${path}\`)` ); } @@ -54,39 +56,37 @@ function getRequestOpts(self, requestArgs, spec, overrideData) { } // Pull request data and options (headers, auth) from args. - var dataFromArgs = utils.getDataFromArgs(args); - var data = encode(Object.assign({}, dataFromArgs, overrideData)); - var options = utils.getOptionsFromArgs(args); + const dataFromArgs = utils.getDataFromArgs(args); + const data = encode(Object.assign({}, dataFromArgs, overrideData)); + const options = utils.getOptionsFromArgs(args); // Validate that there are no more args. if (args.length) { path = self.createResourcePathWithSymbols(spec.path); throw new Error( - 'Stripe: Unknown arguments (' + args + '). Did you mean to pass an options ' + - 'object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.' + - ' (on API request to ' + requestMethod + ' `' + path + '`)' + `Stripe: Unknown arguments (${args}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to ${requestMethod} \`${path}\`)` ); } - var requestPath = self.createFullPath(commandPath, urlData); - var headers = Object.assign(options.headers, spec.headers); + const requestPath = self.createFullPath(commandPath, urlData); + const headers = Object.assign(options.headers, spec.headers); if (spec.validator) { - spec.validator(data, {headers: headers}); + spec.validator(data, {headers}); } return { - requestMethod: requestMethod, - requestPath: requestPath, - data: data, + requestMethod, + requestPath, + data, auth: options.auth, - headers: headers, - host: host, + headers, + host, }; } function makeRequest(self, requestArgs, spec, overrideData) { - return new Promise(function(resolve, reject) { + return new Promise((resolve, reject) => { try { var opts = getRequestOpts(self, requestArgs, spec, overrideData); } catch (err) { @@ -99,14 +99,22 @@ function makeRequest(self, requestArgs, spec, overrideData) { reject(err); } else { resolve( - spec.transformResponseData ? - spec.transformResponseData(response) : - response + spec.transformResponseData + ? spec.transformResponseData(response) + : response ); } } - self._request(opts.requestMethod, opts.host, opts.requestPath, opts.data, opts.auth, {headers: opts.headers}, requestCallback); + self._request( + opts.requestMethod, + opts.host, + opts.requestPath, + opts.data, + opts.auth, + {headers: opts.headers}, + requestCallback + ); }); } diff --git a/lib/resources/AccountLinks.js b/lib/resources/AccountLinks.js index 33bd4a2940..d3ce047afd 100644 --- a/lib/resources/AccountLinks.js +++ b/lib/resources/AccountLinks.js @@ -4,4 +4,3 @@ module.exports = require('../StripeResource').extend({ path: 'account_links', includeBasic: ['create'], }); - diff --git a/lib/resources/Accounts.js b/lib/resources/Accounts.js index 2dfd46d571..75e25acf1d 100644 --- a/lib/resources/Accounts.js +++ b/lib/resources/Accounts.js @@ -1,7 +1,7 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ // Since path can either be `account` or `accounts`, support both through stripeMethod path @@ -36,7 +36,7 @@ module.exports = StripeResource.extend({ urlParams: ['id'], }), - retrieve: function(id) { + retrieve(id) { // No longer allow an api key to be passed as the first string to this function due to ambiguity between // old account ids and api keys. To request the account for an api key, send null as the id if (typeof id === 'string') { @@ -93,8 +93,8 @@ module.exports = StripeResource.extend({ }), /** - * Accounts: LoginLink methods - */ + * Accounts: LoginLink methods + */ createLoginLink: stripeMethod({ method: 'POST', diff --git a/lib/resources/ApplePayDomains.js b/lib/resources/ApplePayDomains.js index 4d05c2523b..2faa067f6b 100644 --- a/lib/resources/ApplePayDomains.js +++ b/lib/resources/ApplePayDomains.js @@ -2,5 +2,5 @@ module.exports = require('../StripeResource').extend({ path: 'apple_pay/domains', - includeBasic: ['create', 'list', 'retrieve', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve'], }); diff --git a/lib/resources/ApplicationFeeRefunds.js b/lib/resources/ApplicationFeeRefunds.js index e73a018cd4..616d1d60fe 100644 --- a/lib/resources/ApplicationFeeRefunds.js +++ b/lib/resources/ApplicationFeeRefunds.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * ApplicationFeeRefunds is a unique resource in that, upon instantiation, diff --git a/lib/resources/ApplicationFees.js b/lib/resources/ApplicationFees.js index 0e96e4ed65..d3261bf216 100644 --- a/lib/resources/ApplicationFees.js +++ b/lib/resources/ApplicationFees.js @@ -1,15 +1,12 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'application_fees', - includeBasic: [ - 'list', 'retrieve', - ], + includeBasic: ['list', 'retrieve'], refund: stripeMethod({ method: 'POST', diff --git a/lib/resources/Balance.js b/lib/resources/Balance.js index a6c5f1655c..1a351806dd 100644 --- a/lib/resources/Balance.js +++ b/lib/resources/Balance.js @@ -1,10 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'balance', retrieve: stripeMethod({ @@ -22,5 +21,4 @@ module.exports = StripeResource.extend({ path: 'history/{transactionId}', urlParams: ['transactionId'], }), - }); diff --git a/lib/resources/BitcoinReceivers.js b/lib/resources/BitcoinReceivers.js index 430db040ed..2642e1e9b3 100644 --- a/lib/resources/BitcoinReceivers.js +++ b/lib/resources/BitcoinReceivers.js @@ -1,20 +1,17 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'bitcoin/receivers', - includeBasic: [ - 'list', 'retrieve', 'getMetadata', - ], + includeBasic: ['list', 'retrieve', 'getMetadata'], listTransactions: stripeMethod({ method: 'GET', - path: '/{receiverId}/transactions', - urlParams: ['receiverId'], + path: '/{id}/transactions', + urlParams: ['id'], methodType: 'list', }), }); diff --git a/lib/resources/ChargeRefunds.js b/lib/resources/ChargeRefunds.js index f6de00306d..693a79b0db 100644 --- a/lib/resources/ChargeRefunds.js +++ b/lib/resources/ChargeRefunds.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * ChargeRefunds is a unique resource in that, upon instantiation, diff --git a/lib/resources/Charges.js b/lib/resources/Charges.js index 28a0798aeb..4702bc5bf5 100644 --- a/lib/resources/Charges.js +++ b/lib/resources/Charges.js @@ -1,15 +1,18 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'charges', includeBasic: [ - 'create', 'list', 'retrieve', 'update', - 'setMetadata', 'getMetadata', + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], capture: stripeMethod({ @@ -42,14 +45,14 @@ module.exports = StripeResource.extend({ */ createRefund: stripeMethod({ method: 'POST', - path: '/{chargeId}/refunds', - urlParams: ['chargeId'], + path: '/{id}/refunds', + urlParams: ['id'], }), listRefunds: stripeMethod({ method: 'GET', - path: '/{chargeId}/refunds', - urlParams: ['chargeId'], + path: '/{id}/refunds', + urlParams: ['id'], methodType: 'list', }), @@ -65,11 +68,11 @@ module.exports = StripeResource.extend({ urlParams: ['chargeId', 'refundId'], }), - markAsSafe: function(chargeId) { - return this.update(chargeId, {'fraud_details': {'user_report': 'safe'}}) + markAsSafe(chargeId) { + return this.update(chargeId, {fraud_details: {user_report: 'safe'}}); }, - markAsFraudulent: function(chargeId) { - return this.update(chargeId, {'fraud_details': {'user_report': 'fraudulent'}}) + markAsFraudulent(chargeId) { + return this.update(chargeId, {fraud_details: {user_report: 'fraudulent'}}); }, }); diff --git a/lib/resources/Checkout/Sessions.js b/lib/resources/Checkout/Sessions.js index 3accef7cc0..dd47cf7add 100644 --- a/lib/resources/Checkout/Sessions.js +++ b/lib/resources/Checkout/Sessions.js @@ -1,8 +1,8 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'checkout/sessions', includeBasic: ['create', 'retrieve'], -}) +}); diff --git a/lib/resources/CountrySpecs.js b/lib/resources/CountrySpecs.js index 25210ac31a..b6d5477afe 100644 --- a/lib/resources/CountrySpecs.js +++ b/lib/resources/CountrySpecs.js @@ -1,12 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'country_specs', - includeBasic: [ - 'list', 'retrieve', - ], + includeBasic: ['list', 'retrieve'], }); diff --git a/lib/resources/Coupons.js b/lib/resources/Coupons.js index a9f519afa3..10a1fd4c21 100644 --- a/lib/resources/Coupons.js +++ b/lib/resources/Coupons.js @@ -2,6 +2,5 @@ module.exports = require('../StripeResource').extend({ path: 'coupons', - includeBasic: ['create', 'list', 'update', 'retrieve', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/CreditNotes.js b/lib/resources/CreditNotes.js index 24df5aca90..5baf5b53f3 100644 --- a/lib/resources/CreditNotes.js +++ b/lib/resources/CreditNotes.js @@ -1,16 +1,15 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'credit_notes', includeBasic: ['create', 'list', 'retrieve', 'update'], voidCreditNote: stripeMethod({ method: 'POST', - path: '{creditNoteId}/void', - urlParams: ['creditNoteId'], + path: '{id}/void', + urlParams: ['id'], }), }); diff --git a/lib/resources/CustomerCards.js b/lib/resources/CustomerCards.js index 059c403de2..194d85bec0 100644 --- a/lib/resources/CustomerCards.js +++ b/lib/resources/CustomerCards.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * CustomerCard is a unique resource in that, upon instantiation, diff --git a/lib/resources/CustomerSubscriptions.js b/lib/resources/CustomerSubscriptions.js index 3082d84049..6cde760a2f 100644 --- a/lib/resources/CustomerSubscriptions.js +++ b/lib/resources/CustomerSubscriptions.js @@ -1,7 +1,7 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; /** * CustomerSubscription is a unique resource in that, upon instantiation, diff --git a/lib/resources/Customers.js b/lib/resources/Customers.js index 6a182612ad..7cce50e42c 100644 --- a/lib/resources/Customers.js +++ b/lib/resources/Customers.js @@ -1,15 +1,19 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var utils = require('../utils'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const utils = require('../utils'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'customers', includeBasic: [ - 'create', 'list', 'retrieve', 'update', 'del', - 'setMetadata', 'getMetadata', + 'create', + 'del', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], /** @@ -18,8 +22,8 @@ module.exports = StripeResource.extend({ _legacyUpdateSubscription: stripeMethod({ method: 'POST', - path: '{customerId}/subscription', - urlParams: ['customerId'], + path: '{id}/subscription', + urlParams: ['id'], }), _newstyleUpdateSubscription: stripeMethod({ @@ -30,8 +34,8 @@ module.exports = StripeResource.extend({ _legacyCancelSubscription: stripeMethod({ method: 'DELETE', - path: '{customerId}/subscription', - urlParams: ['customerId'], + path: '{id}/subscription', + urlParams: ['id'], }), _newstyleCancelSubscription: stripeMethod({ @@ -42,14 +46,14 @@ module.exports = StripeResource.extend({ createSubscription: stripeMethod({ method: 'POST', - path: '/{customerId}/subscriptions', - urlParams: ['customerId'], + path: '/{id}/subscriptions', + urlParams: ['id'], }), listSubscriptions: stripeMethod({ method: 'GET', - path: '/{customerId}/subscriptions', - urlParams: ['customerId'], + path: '/{id}/subscriptions', + urlParams: ['id'], methodType: 'list', }), @@ -59,21 +63,21 @@ module.exports = StripeResource.extend({ urlParams: ['customerId', 'subscriptionId'], }), - updateSubscription: function(customerId, subscriptionId) { + updateSubscription(customerId, subscriptionId) { if (typeof subscriptionId == 'string') { - return this._newstyleUpdateSubscription.apply(this, arguments); + return this._newstyleUpdateSubscription(...arguments); } else { - return this._legacyUpdateSubscription.apply(this, arguments); + return this._legacyUpdateSubscription(...arguments); } }, - cancelSubscription: function(customerId, subscriptionId) { + cancelSubscription(customerId, subscriptionId) { // This is a hack, but it lets us maximize our overloading. // Precarious assumption: If it's not an auth key it _could_ be a sub id: if (typeof subscriptionId == 'string' && !utils.isAuthKey(subscriptionId)) { - return this._newstyleCancelSubscription.apply(this, arguments); + return this._newstyleCancelSubscription(...arguments); } else { - return this._legacyCancelSubscription.apply(this, arguments); + return this._legacyCancelSubscription(...arguments); } }, diff --git a/lib/resources/Disputes.js b/lib/resources/Disputes.js index eff2aba687..83c5526c25 100644 --- a/lib/resources/Disputes.js +++ b/lib/resources/Disputes.js @@ -1,21 +1,16 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'disputes', - includeBasic: [ - 'list', 'retrieve', 'update', 'setMetadata', 'getMetadata', - ], + includeBasic: ['list', 'retrieve', 'update', 'setMetadata', 'getMetadata'], close: stripeMethod({ method: 'POST', path: '/{id}/close', urlParams: ['id'], }), - }); - diff --git a/lib/resources/EphemeralKeys.js b/lib/resources/EphemeralKeys.js index 2be6f9c9d5..96cee89368 100644 --- a/lib/resources/EphemeralKeys.js +++ b/lib/resources/EphemeralKeys.js @@ -1,14 +1,16 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ create: stripeMethod({ method: 'POST', - validator: function(data, options) { + validator: (data, options) => { if (!options.headers || !options.headers['Stripe-Version']) { - throw new Error('stripe_version must be specified to create an ephemeral key'); + throw new Error( + 'stripe_version must be specified to create an ephemeral key' + ); } }, }), diff --git a/lib/resources/Events.js b/lib/resources/Events.js index ae4f092432..8de01785c6 100644 --- a/lib/resources/Events.js +++ b/lib/resources/Events.js @@ -4,4 +4,3 @@ module.exports = require('../StripeResource').extend({ path: 'events', includeBasic: ['list', 'retrieve'], }); - diff --git a/lib/resources/ExchangeRates.js b/lib/resources/ExchangeRates.js index a7d3b10853..7a314cadca 100644 --- a/lib/resources/ExchangeRates.js +++ b/lib/resources/ExchangeRates.js @@ -1,12 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'exchange_rates', - includeBasic: [ - 'list', 'retrieve', - ], + includeBasic: ['list', 'retrieve'], }); diff --git a/lib/resources/FileLinks.js b/lib/resources/FileLinks.js index 8052fc7f02..8c264d061a 100644 --- a/lib/resources/FileLinks.js +++ b/lib/resources/FileLinks.js @@ -1,11 +1,15 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'file_links', includeBasic: [ - 'create', 'list', 'retrieve', 'update', 'setMetadata', 'getMetadata', + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], }); diff --git a/lib/resources/Files.js b/lib/resources/Files.js index 0315d3092d..b400d002fe 100644 --- a/lib/resources/Files.js +++ b/lib/resources/Files.js @@ -1,15 +1,14 @@ 'use strict'; -var Buffer = require('safe-buffer').Buffer; -var utils = require('../utils'); -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; -var multipartDataGenerator = require('../MultipartDataGenerator'); -var Error = require('../Error'); +const Buffer = require('safe-buffer').Buffer; +const utils = require('../utils'); +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; +const multipartDataGenerator = require('../MultipartDataGenerator'); +const Error = require('../Error'); module.exports = StripeResource.extend({ - - requestDataProcessor: function(method, data, headers, callback) { + requestDataProcessor(method, data, headers, callback) { data = data || {}; if (method === 'POST') { @@ -19,48 +18,52 @@ module.exports = StripeResource.extend({ } function getProcessorForSourceType(data) { - var isStream = utils.checkForStream(data); + const isStream = utils.checkForStream(data); if (isStream) { return streamProcessor(multipartDataGenerator); } else { - var buffer = multipartDataGenerator(method, data, headers); + const buffer = multipartDataGenerator(method, data, headers); return callback(null, buffer); } } - function streamProcessor (fn) { - var bufferArray = []; - data.file.data.on('data', function(line) { - bufferArray.push(line); - }).on('end', function() { - var bufferData = Object.assign({}, data); - bufferData.file.data = Buffer.concat(bufferArray); - var buffer = fn(method, bufferData, headers); - callback(null, buffer); - }).on('error', function(err) { - var errorHandler = streamError(callback); - errorHandler(err); - }); + function streamProcessor(fn) { + const bufferArray = []; + data.file.data + .on('data', (line) => { + bufferArray.push(line); + }) + .on('end', () => { + const bufferData = Object.assign({}, data); + bufferData.file.data = Buffer.concat(bufferArray); + const buffer = fn(method, bufferData, headers); + callback(null, buffer); + }) + .on('error', (err) => { + const errorHandler = streamError(callback); + errorHandler(err); + }); } function streamError(callback) { - var StreamProcessingError = Error.extend({ + const StreamProcessingError = Error.extend({ type: 'StreamProcessingError', - populate: function(raw) { + populate(raw) { this.type = this.type; this.message = raw.message; this.detail = raw.detail; - } + }, }); - return function(error) { + return (error) => { callback( new StreamProcessingError({ - message: 'An error occurred while attempting to process the file for upload.', + message: + 'An error occurred while attempting to process the file for upload.', detail: error, }), null ); - } + }; } }, diff --git a/lib/resources/InvoiceItems.js b/lib/resources/InvoiceItems.js index 00af738ed5..c4a2142097 100644 --- a/lib/resources/InvoiceItems.js +++ b/lib/resources/InvoiceItems.js @@ -3,8 +3,12 @@ module.exports = require('../StripeResource').extend({ path: 'invoiceitems', includeBasic: [ - 'create', 'list', 'retrieve', 'update', 'del', - 'setMetadata', 'getMetadata', + 'create', + 'del', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], }); - diff --git a/lib/resources/Invoices.js b/lib/resources/Invoices.js index cac74797ce..39f1dea8f3 100644 --- a/lib/resources/Invoices.js +++ b/lib/resources/Invoices.js @@ -1,75 +1,97 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; -var utils = require('../utils'); +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; +const utils = require('../utils'); module.exports = StripeResource.extend({ - path: 'invoices', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], finalizeInvoice: stripeMethod({ method: 'POST', - path: '{invoiceId}/finalize', - urlParams: ['invoiceId'], + path: '{id}/finalize', + urlParams: ['id'], }), markUncollectible: stripeMethod({ method: 'POST', - path: '{invoiceId}/mark_uncollectible', - urlParams: ['invoiceId'], + path: '{id}/mark_uncollectible', + urlParams: ['id'], }), pay: stripeMethod({ method: 'POST', - path: '{invoiceId}/pay', - urlParams: ['invoiceId'], + path: '{id}/pay', + urlParams: ['id'], }), retrieveLines: stripeMethod({ method: 'GET', - path: '{invoiceId}/lines', - urlParams: ['invoiceId'], + path: '{id}/lines', + urlParams: ['id'], }), retrieveUpcoming: stripeMethod({ method: 'GET', - path: function(urlData) { - var url = 'upcoming?'; - var hasParam = false; + path(urlData) { + let url = 'upcoming?'; + let hasParam = false; // If you pass just a hash with the relevant parameters, including customer id inside. - if (urlData.invoiceOptionsOrCustomerId && typeof urlData.invoiceOptionsOrCustomerId === 'object') { - return url + utils.stringifyRequestData(urlData.invoiceOptionsOrCustomerId); + if ( + urlData.invoiceOptionsOrCustomerId && + typeof urlData.invoiceOptionsOrCustomerId === 'object' + ) { + return ( + url + utils.stringifyRequestData(urlData.invoiceOptionsOrCustomerId) + ); } // Legacy implementation where the first parameter is a customer id as a string - if (urlData.invoiceOptionsOrCustomerId && typeof urlData.invoiceOptionsOrCustomerId === 'string') { - url = url + 'customer=' + urlData.invoiceOptionsOrCustomerId; + if ( + urlData.invoiceOptionsOrCustomerId && + typeof urlData.invoiceOptionsOrCustomerId === 'string' + ) { + url = `${url}customer=${urlData.invoiceOptionsOrCustomerId}`; hasParam = true; } // Legacy support where second argument is the subscription id - if (urlData.invoiceOptionsOrSubscriptionId && typeof urlData.invoiceOptionsOrSubscriptionId === 'string') { - return url + (hasParam ? '&' : '') + 'subscription=' + urlData.invoiceOptionsOrSubscriptionId; - } else if (urlData.invoiceOptionsOrSubscriptionId && typeof urlData.invoiceOptionsOrSubscriptionId === 'object') { - return url + (hasParam ? '&' : '') + utils.stringifyRequestData(urlData.invoiceOptionsOrSubscriptionId); + if ( + urlData.invoiceOptionsOrSubscriptionId && + typeof urlData.invoiceOptionsOrSubscriptionId === 'string' + ) { + return `${url + (hasParam ? '&' : '')}subscription=${ + urlData.invoiceOptionsOrSubscriptionId + }`; + } else if ( + urlData.invoiceOptionsOrSubscriptionId && + typeof urlData.invoiceOptionsOrSubscriptionId === 'object' + ) { + return ( + url + + (hasParam ? '&' : '') + + utils.stringifyRequestData(urlData.invoiceOptionsOrSubscriptionId) + ); } return url; }, - urlParams: ['optional!invoiceOptionsOrCustomerId', 'optional!invoiceOptionsOrSubscriptionId'], + urlParams: [ + 'optional!invoiceOptionsOrCustomerId', + 'optional!invoiceOptionsOrSubscriptionId', + ], }), sendInvoice: stripeMethod({ method: 'POST', - path: '{invoiceId}/send', - urlParams: ['invoiceId'], + path: '{id}/send', + urlParams: ['id'], }), voidInvoice: stripeMethod({ method: 'POST', - path: '{invoiceId}/void', - urlParams: ['invoiceId'], + path: '{id}/void', + urlParams: ['id'], }), }); diff --git a/lib/resources/IssuerFraudRecords.js b/lib/resources/IssuerFraudRecords.js index 76c1e1e4d0..97d38fd133 100644 --- a/lib/resources/IssuerFraudRecords.js +++ b/lib/resources/IssuerFraudRecords.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ path: 'issuer_fraud_records', diff --git a/lib/resources/Issuing/Authorizations.js b/lib/resources/Issuing/Authorizations.js index a17deec892..85756a6935 100644 --- a/lib/resources/Issuing/Authorizations.js +++ b/lib/resources/Issuing/Authorizations.js @@ -1,7 +1,7 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'issuing/authorizations', diff --git a/lib/resources/Issuing/Cardholders.js b/lib/resources/Issuing/Cardholders.js index e8a175e918..58dd2630b9 100644 --- a/lib/resources/Issuing/Cardholders.js +++ b/lib/resources/Issuing/Cardholders.js @@ -1,8 +1,15 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'issuing/cardholders', - includeBasic: ['create', 'list', 'retrieve', 'update', 'setMetadata', 'getMetadata'], + includeBasic: [ + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', + ], }); diff --git a/lib/resources/Issuing/Cards.js b/lib/resources/Issuing/Cards.js index 99199642e8..f8026ab5fc 100644 --- a/lib/resources/Issuing/Cards.js +++ b/lib/resources/Issuing/Cards.js @@ -1,12 +1,19 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'issuing/cards', - includeBasic: ['create', 'list', 'retrieve', 'update', 'setMetadata', 'getMetadata'], + includeBasic: [ + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', + ], retrieveDetails: stripeMethod({ method: 'GET', diff --git a/lib/resources/Issuing/Disputes.js b/lib/resources/Issuing/Disputes.js index 296fa779f7..a26015a3ca 100644 --- a/lib/resources/Issuing/Disputes.js +++ b/lib/resources/Issuing/Disputes.js @@ -1,8 +1,15 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'issuing/disputes', - includeBasic: ['create', 'list', 'retrieve', 'update', 'setMetadata', 'getMetadata'], + includeBasic: [ + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', + ], }); diff --git a/lib/resources/Issuing/Transactions.js b/lib/resources/Issuing/Transactions.js index f7f004bbd8..789292ff2a 100644 --- a/lib/resources/Issuing/Transactions.js +++ b/lib/resources/Issuing/Transactions.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'issuing/transactions', diff --git a/lib/resources/LoginLinks.js b/lib/resources/LoginLinks.js index ac82bc71c9..b76439e000 100644 --- a/lib/resources/LoginLinks.js +++ b/lib/resources/LoginLinks.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ path: 'accounts/{accountId}/login_links', diff --git a/lib/resources/OAuth.js b/lib/resources/OAuth.js index 1649599119..70ce4a2358 100644 --- a/lib/resources/OAuth.js +++ b/lib/resources/OAuth.js @@ -1,23 +1,23 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; -var utils = require('../utils'); +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; +const utils = require('../utils'); -var oAuthHost = 'connect.stripe.com'; +const oAuthHost = 'connect.stripe.com'; module.exports = StripeResource.extend({ basePath: '/', - authorizeUrl: function(params, options) { + authorizeUrl(params, options) { params = params || {}; options = options || {}; - var path = 'oauth/authorize'; + let path = 'oauth/authorize'; // For Express accounts, the path changes if (options.express) { - path = 'express/' + path; + path = `express/${path}`; } if (!params.response_type) { @@ -32,7 +32,7 @@ module.exports = StripeResource.extend({ params.scope = 'read_write'; } - return 'https://' + oAuthHost + '/' + path + '?' + utils.stringifyRequestData(params); + return `https://${oAuthHost}/${path}?${utils.stringifyRequestData(params)}`; }, token: stripeMethod({ @@ -41,7 +41,7 @@ module.exports = StripeResource.extend({ host: oAuthHost, }), - deauthorize: function(spec) { + deauthorize(spec) { if (!spec.client_id) { spec.client_id = this._stripe.getClientId(); } diff --git a/lib/resources/OrderReturns.js b/lib/resources/OrderReturns.js index 777821a682..058c702c87 100644 --- a/lib/resources/OrderReturns.js +++ b/lib/resources/OrderReturns.js @@ -1,12 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'order_returns', - includeBasic: [ - 'list', 'retrieve', - ], + includeBasic: ['list', 'retrieve'], }); diff --git a/lib/resources/Orders.js b/lib/resources/Orders.js index 0e32b3fdca..371c3ec486 100644 --- a/lib/resources/Orders.js +++ b/lib/resources/Orders.js @@ -1,26 +1,22 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'orders', - includeBasic: [ - 'create', 'list', 'retrieve', 'update', - ], + includeBasic: ['create', 'list', 'retrieve', 'update'], pay: stripeMethod({ method: 'POST', - path: '/{orderId}/pay', - urlParams: ['orderId'], + path: '/{id}/pay', + urlParams: ['id'], }), returnOrder: stripeMethod({ method: 'POST', - path: '/{orderId}/returns', - urlParams: ['orderId'], + path: '/{id}/returns', + urlParams: ['id'], }), - }); diff --git a/lib/resources/PaymentIntents.js b/lib/resources/PaymentIntents.js index fae0950b27..7093b21ee7 100644 --- a/lib/resources/PaymentIntents.js +++ b/lib/resources/PaymentIntents.js @@ -1,7 +1,7 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'payment_intents', @@ -9,20 +9,19 @@ module.exports = StripeResource.extend({ cancel: stripeMethod({ method: 'POST', - path: '{paymentIntentId}/cancel', - urlParams: ['paymentIntentId'], + path: '{id}/cancel', + urlParams: ['id'], }), capture: stripeMethod({ method: 'POST', - path: '{paymentIntentId}/capture', - urlParams: ['paymentIntentId'], + path: '{id}/capture', + urlParams: ['id'], }), confirm: stripeMethod({ method: 'POST', - path: '{paymentIntentId}/confirm', - urlParams: ['paymentIntentId'], + path: '{id}/confirm', + urlParams: ['id'], }), }); - diff --git a/lib/resources/PaymentMethods.js b/lib/resources/PaymentMethods.js index 54f3c829c5..cc6201749e 100644 --- a/lib/resources/PaymentMethods.js +++ b/lib/resources/PaymentMethods.js @@ -1,22 +1,21 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'payment_methods', includeBasic: ['create', 'list', 'retrieve', 'update'], attach: stripeMethod({ method: 'POST', - path: '{paymentMethodId}/attach', - urlParams: ['paymentMethodId'], + path: '{id}/attach', + urlParams: ['id'], }), detach: stripeMethod({ method: 'POST', - path: '{paymentMethodId}/detach', - urlParams: ['paymentMethodId'], + path: '{id}/detach', + urlParams: ['id'], }), }); diff --git a/lib/resources/Payouts.js b/lib/resources/Payouts.js index 433b5b04ae..8cd32d9c9c 100644 --- a/lib/resources/Payouts.js +++ b/lib/resources/Payouts.js @@ -1,28 +1,30 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'payouts', includeBasic: [ - 'create', 'list', 'retrieve', 'update', - 'setMetadata', 'getMetadata', + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], cancel: stripeMethod({ method: 'POST', - path: '{payoutId}/cancel', - urlParams: ['payoutId'], + path: '{id}/cancel', + urlParams: ['id'], }), listTransactions: stripeMethod({ method: 'GET', - path: '{payoutId}/transactions', - urlParams: ['payoutId'], + path: '{id}/transactions', + urlParams: ['id'], methodType: 'list', }), }); - diff --git a/lib/resources/Persons.js b/lib/resources/Persons.js index 605bd24b48..8de5bacd0b 100644 --- a/lib/resources/Persons.js +++ b/lib/resources/Persons.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * Persons is a unique resource in that, upon instantiation, @@ -18,4 +18,3 @@ module.exports = StripeResource.extend({ path: 'accounts/{accountId}/persons', includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/Plans.js b/lib/resources/Plans.js index a7d01bae8a..a686d9c304 100644 --- a/lib/resources/Plans.js +++ b/lib/resources/Plans.js @@ -2,6 +2,5 @@ module.exports = require('../StripeResource').extend({ path: 'plans', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/Products.js b/lib/resources/Products.js index d8bcedef5c..02da55d5da 100644 --- a/lib/resources/Products.js +++ b/lib/resources/Products.js @@ -1,13 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'products', - includeBasic: [ - 'create', 'list', 'retrieve', 'update', 'del', - ], - + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); diff --git a/lib/resources/Radar/ValueListItems.js b/lib/resources/Radar/ValueListItems.js index f15d4e69b2..055ea00004 100644 --- a/lib/resources/Radar/ValueListItems.js +++ b/lib/resources/Radar/ValueListItems.js @@ -1,8 +1,8 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'radar/value_list_items', - includeBasic: ['create', 'list', 'retrieve', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve'], }); diff --git a/lib/resources/Radar/ValueLists.js b/lib/resources/Radar/ValueLists.js index afda83a75c..63d4134239 100644 --- a/lib/resources/Radar/ValueLists.js +++ b/lib/resources/Radar/ValueLists.js @@ -1,8 +1,8 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'radar/value_lists', - includeBasic: ['create', 'list', 'update', 'retrieve', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); diff --git a/lib/resources/RecipientCards.js b/lib/resources/RecipientCards.js index 2986003798..0dc675bdcc 100644 --- a/lib/resources/RecipientCards.js +++ b/lib/resources/RecipientCards.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * RecipientCard is similar to CustomerCard in that, upon instantiation, it diff --git a/lib/resources/Recipients.js b/lib/resources/Recipients.js index 536e98f730..e9adaec076 100644 --- a/lib/resources/Recipients.js +++ b/lib/resources/Recipients.js @@ -1,26 +1,30 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'recipients', includeBasic: [ - 'create', 'list', 'retrieve', 'update', 'del', - 'setMetadata', 'getMetadata', + 'create', + 'del', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], createCard: stripeMethod({ method: 'POST', - path: '/{recipientId}/cards', - urlParams: ['recipientId'], + path: '/{id}/cards', + urlParams: ['id'], }), listCards: stripeMethod({ method: 'GET', - path: '/{recipientId}/cards', - urlParams: ['recipientId'], + path: '/{id}/cards', + urlParams: ['id'], methodType: 'list', }), @@ -41,6 +45,4 @@ module.exports = StripeResource.extend({ path: '/{recipientId}/cards/{cardId}', urlParams: ['recipientId', 'cardId'], }), - }); - diff --git a/lib/resources/Refunds.js b/lib/resources/Refunds.js index e4e70c1eb4..76373c92c0 100644 --- a/lib/resources/Refunds.js +++ b/lib/resources/Refunds.js @@ -1,13 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'refunds', - includeBasic: [ - 'create', 'list', 'retrieve', 'update', - ], + includeBasic: ['create', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/Reporting/ReportRuns.js b/lib/resources/Reporting/ReportRuns.js index 46d8a989d6..9cf3cbc6df 100644 --- a/lib/resources/Reporting/ReportRuns.js +++ b/lib/resources/Reporting/ReportRuns.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'reporting/report_runs', diff --git a/lib/resources/Reporting/ReportTypes.js b/lib/resources/Reporting/ReportTypes.js index 576c2aad4b..ff3dee3167 100644 --- a/lib/resources/Reporting/ReportTypes.js +++ b/lib/resources/Reporting/ReportTypes.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'reporting/report_types', diff --git a/lib/resources/Reviews.js b/lib/resources/Reviews.js index 9eeb7f413e..40a150512d 100644 --- a/lib/resources/Reviews.js +++ b/lib/resources/Reviews.js @@ -1,10 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'reviews', includeBasic: ['list', 'retrieve'], @@ -15,4 +14,3 @@ module.exports = StripeResource.extend({ urlParams: ['id'], }), }); - diff --git a/lib/resources/SKUs.js b/lib/resources/SKUs.js index 0364ed4ed2..9fd01cf439 100644 --- a/lib/resources/SKUs.js +++ b/lib/resources/SKUs.js @@ -1,13 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: 'skus', - includeBasic: [ - 'create', 'list', 'retrieve', 'update', 'del', - ], - + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); diff --git a/lib/resources/Sigma/ScheduledQueryRuns.js b/lib/resources/Sigma/ScheduledQueryRuns.js index bc80b40040..0714497062 100644 --- a/lib/resources/Sigma/ScheduledQueryRuns.js +++ b/lib/resources/Sigma/ScheduledQueryRuns.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'sigma/scheduled_query_runs', diff --git a/lib/resources/Sources.js b/lib/resources/Sources.js index 255896dd38..78e7a87675 100644 --- a/lib/resources/Sources.js +++ b/lib/resources/Sources.js @@ -1,15 +1,12 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'sources', - includeBasic: [ - 'create', 'retrieve', 'update', 'setMetadata', 'getMetadata', - ], + includeBasic: ['create', 'retrieve', 'update', 'setMetadata', 'getMetadata'], listSourceTransactions: stripeMethod({ method: 'GET', @@ -23,5 +20,4 @@ module.exports = StripeResource.extend({ path: '/{id}/verify', urlParams: ['id'], }), - }); diff --git a/lib/resources/SubscriptionItems.js b/lib/resources/SubscriptionItems.js index ea6e8e006e..4c159e0ced 100644 --- a/lib/resources/SubscriptionItems.js +++ b/lib/resources/SubscriptionItems.js @@ -1,9 +1,8 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ path: 'subscription_items', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del',], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/SubscriptionScheduleRevisions.js b/lib/resources/SubscriptionScheduleRevisions.js index c230e37379..8998b7007a 100644 --- a/lib/resources/SubscriptionScheduleRevisions.js +++ b/lib/resources/SubscriptionScheduleRevisions.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * SubscriptionScheduleRevisions is a unique resource in that, upon instantiation, @@ -16,5 +16,5 @@ var StripeResource = require('../StripeResource'); */ module.exports = StripeResource.extend({ path: 'subscription_schedules/{scheduleId}/revisions', - includeBasic: ['list', 'retrieve',], + includeBasic: ['list', 'retrieve'], }); diff --git a/lib/resources/SubscriptionSchedules.js b/lib/resources/SubscriptionSchedules.js index 0f838bdbb1..f135a0ef2a 100644 --- a/lib/resources/SubscriptionSchedules.js +++ b/lib/resources/SubscriptionSchedules.js @@ -1,15 +1,18 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'subscription_schedules', includeBasic: [ - 'create', 'list', 'retrieve', 'update', - 'setMetadata', 'getMetadata', + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], release: stripeMethod({ diff --git a/lib/resources/Subscriptions.js b/lib/resources/Subscriptions.js index a014c5d85a..5bb1d5f784 100644 --- a/lib/resources/Subscriptions.js +++ b/lib/resources/Subscriptions.js @@ -1,19 +1,18 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'subscriptions', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del',], + includeBasic: ['create', 'list', 'retrieve', 'update', 'del'], /** * Subscription: Discount methods */ deleteDiscount: stripeMethod({ method: 'DELETE', - path: '/{subscriptionId}/discount', - urlParams: ['subscriptionId'], + path: '/{id}/discount', + urlParams: ['id'], }), }); diff --git a/lib/resources/TaxIds.js b/lib/resources/TaxIds.js index bc8d860452..301782eda2 100644 --- a/lib/resources/TaxIds.js +++ b/lib/resources/TaxIds.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * TaxIds is a unique resource in that, upon instantiation, diff --git a/lib/resources/TaxRates.js b/lib/resources/TaxRates.js index 7bea8e7f33..d7965ed60e 100644 --- a/lib/resources/TaxRates.js +++ b/lib/resources/TaxRates.js @@ -2,6 +2,5 @@ module.exports = require('../StripeResource').extend({ path: 'tax_rates', - includeBasic: ['create', 'list', 'update', 'retrieve'], + includeBasic: ['create', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/Terminal/ConnectionTokens.js b/lib/resources/Terminal/ConnectionTokens.js index a7c4d68f3b..76195dda70 100644 --- a/lib/resources/Terminal/ConnectionTokens.js +++ b/lib/resources/Terminal/ConnectionTokens.js @@ -1,8 +1,8 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'terminal/connection_tokens', includeBasic: ['create'], -}) +}); diff --git a/lib/resources/Terminal/Locations.js b/lib/resources/Terminal/Locations.js index 0f2dccaf03..0748bbd0cb 100644 --- a/lib/resources/Terminal/Locations.js +++ b/lib/resources/Terminal/Locations.js @@ -1,8 +1,8 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'terminal/locations', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del'], -}) + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], +}); diff --git a/lib/resources/Terminal/Readers.js b/lib/resources/Terminal/Readers.js index a4b2322a4e..b5dddc3929 100644 --- a/lib/resources/Terminal/Readers.js +++ b/lib/resources/Terminal/Readers.js @@ -1,8 +1,8 @@ 'use strict'; -var StripeResource = require('../../StripeResource'); +const StripeResource = require('../../StripeResource'); module.exports = StripeResource.extend({ path: 'terminal/readers', - includeBasic: ['create', 'list', 'retrieve', 'update', 'del'], -}) + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], +}); diff --git a/lib/resources/ThreeDSecure.js b/lib/resources/ThreeDSecure.js index 52a49e579b..96248d1ea9 100644 --- a/lib/resources/ThreeDSecure.js +++ b/lib/resources/ThreeDSecure.js @@ -1,13 +1,9 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); module.exports = StripeResource.extend({ - path: '3d_secure', - includeBasic: [ - 'create', - 'retrieve', - ], + includeBasic: ['create', 'retrieve'], }); diff --git a/lib/resources/Topups.js b/lib/resources/Topups.js index 72875168ba..ef57d1ff3f 100644 --- a/lib/resources/Topups.js +++ b/lib/resources/Topups.js @@ -1,15 +1,22 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'topups', - includeBasic: ['create', 'list', 'retrieve', 'update', 'setMetadata', 'getMetadata'], + includeBasic: [ + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', + ], cancel: stripeMethod({ method: 'POST', - path: '{topupId}/cancel', - urlParams: ['topupId'], + path: '{id}/cancel', + urlParams: ['id'], }), }); diff --git a/lib/resources/TransferReversals.js b/lib/resources/TransferReversals.js index a73081f12d..4eb4603796 100644 --- a/lib/resources/TransferReversals.js +++ b/lib/resources/TransferReversals.js @@ -1,6 +1,6 @@ 'use strict'; -var StripeResource = require('../StripeResource'); +const StripeResource = require('../StripeResource'); /** * TransferReversals is a unique resource in that, upon instantiation, @@ -18,4 +18,3 @@ module.exports = StripeResource.extend({ path: 'transfers/{transferId}/reversals', includeBasic: ['create', 'list', 'retrieve', 'update'], }); - diff --git a/lib/resources/Transfers.js b/lib/resources/Transfers.js index f93a20f684..2a0cb92ddf 100644 --- a/lib/resources/Transfers.js +++ b/lib/resources/Transfers.js @@ -1,33 +1,36 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ - path: 'transfers', includeBasic: [ - 'create', 'list', 'retrieve', 'update', - 'setMetadata', 'getMetadata', + 'create', + 'list', + 'retrieve', + 'update', + 'setMetadata', + 'getMetadata', ], reverse: stripeMethod({ method: 'POST', - path: '/{transferId}/reversals', - urlParams: ['transferId'], + path: '/{id}/reversals', + urlParams: ['id'], }), cancel: stripeMethod({ method: 'POST', - path: '{transferId}/cancel', - urlParams: ['transferId'], + path: '{id}/cancel', + urlParams: ['id'], }), listTransactions: stripeMethod({ method: 'GET', - path: '{transferId}/transactions', - urlParams: ['transferId'], + path: '{id}/transactions', + urlParams: ['id'], methodType: 'list', }), @@ -36,14 +39,14 @@ module.exports = StripeResource.extend({ */ createReversal: stripeMethod({ method: 'POST', - path: '/{transferId}/reversals', - urlParams: ['transferId'], + path: '/{id}/reversals', + urlParams: ['id'], }), listReversals: stripeMethod({ method: 'GET', - path: '/{transferId}/reversals', - urlParams: ['transferId'], + path: '/{id}/reversals', + urlParams: ['id'], methodType: 'list', }), @@ -59,4 +62,3 @@ module.exports = StripeResource.extend({ urlParams: ['transferId', 'reversalId'], }), }); - diff --git a/lib/resources/UsageRecordSummaries.js b/lib/resources/UsageRecordSummaries.js index f0f438f33e..8a59a43ef6 100644 --- a/lib/resources/UsageRecordSummaries.js +++ b/lib/resources/UsageRecordSummaries.js @@ -1,7 +1,7 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'subscription_items', diff --git a/lib/resources/UsageRecords.js b/lib/resources/UsageRecords.js index fb4eb1436a..26829eccd3 100644 --- a/lib/resources/UsageRecords.js +++ b/lib/resources/UsageRecords.js @@ -1,14 +1,14 @@ 'use strict'; -var StripeResource = require('../StripeResource'); -var stripeMethod = StripeResource.method; +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ path: 'subscription_items', create: stripeMethod({ method: 'POST', - path: '{subscriptionItem}/usage_records', - urlParams: ['subscriptionItem'], + path: '{id}/usage_records', + urlParams: ['id'], }), }); diff --git a/lib/resources/WebhookEndpoints.js b/lib/resources/WebhookEndpoints.js index 149d4cd888..1277b5dce5 100644 --- a/lib/resources/WebhookEndpoints.js +++ b/lib/resources/WebhookEndpoints.js @@ -2,6 +2,5 @@ module.exports = require('../StripeResource').extend({ path: 'webhook_endpoints', - includeBasic: ['create', 'list', 'update', 'retrieve', 'del'], + includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], }); - diff --git a/lib/stripe.js b/lib/stripe.js index fa5d96f51b..2c7a5950e5 100644 --- a/lib/stripe.js +++ b/lib/stripe.js @@ -24,14 +24,14 @@ Stripe.USER_AGENT_SERIALIZED = null; Stripe.MAX_NETWORK_RETRY_DELAY_SEC = 2; Stripe.INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5; -var APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; +const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; -var EventEmitter = require('events').EventEmitter; -var utils = require('./utils'); +const EventEmitter = require('events').EventEmitter; +const utils = require('./utils'); -var resourceNamespace = require('./ResourceNamespace'); +const resourceNamespace = require('./ResourceNamespace'); -var resources = { +const resources = { // Support Accounts for consistency, Account for backwards compat Account: require('./resources/Accounts'), Accounts: require('./resources/Accounts'), @@ -169,7 +169,7 @@ Stripe.errors = require('./Error'); Stripe.webhooks = require('./Webhooks'); Stripe.prototype = { - setHost: function(host, port, protocol) { + setHost(host, port, protocol) { this._setApiField('host', host); if (port) { this.setPort(port); @@ -179,37 +179,34 @@ Stripe.prototype = { } }, - setProtocol: function(protocol) { + setProtocol(protocol) { this._setApiField('protocol', protocol.toLowerCase()); }, - setPort: function(port) { + setPort(port) { this._setApiField('port', port); }, - setApiVersion: function(version) { + setApiVersion(version) { if (version) { this._setApiField('version', version); } }, - setApiKey: function(key) { + setApiKey(key) { if (key) { - this._setApiField( - 'auth', - 'Bearer ' + key - ); + this._setApiField('auth', `Bearer ${key}`); } }, - setTimeout: function(timeout) { + setTimeout(timeout) { this._setApiField( 'timeout', timeout == null ? Stripe.DEFAULT_TIMEOUT : timeout ); }, - setAppInfo: function(info) { + setAppInfo(info) { if (info && typeof info !== 'object') { throw new Error('AppInfo must be an object.'); } @@ -220,7 +217,7 @@ Stripe.prototype = { info = info || {}; - var appInfo = APP_INFO_PROPERTIES.reduce(function(accum, prop) { + const appInfo = APP_INFO_PROPERTIES.reduce((accum, prop) => { if (typeof info[prop] == 'string') { accum = accum || {}; @@ -236,112 +233,113 @@ Stripe.prototype = { this._appInfo = appInfo; }, - setHttpAgent: function(agent) { + setHttpAgent(agent) { this._setApiField('agent', agent); }, - _setApiField: function(key, value) { + _setApiField(key, value) { this._api[key] = value; }, - getApiField: function(key) { + getApiField(key) { return this._api[key]; }, - setClientId: function(clientId) { + setClientId(clientId) { this._clientId = clientId; }, - getClientId: function() { + getClientId() { return this._clientId; }, - getConstant: function(c) { + getConstant: (c) => { return Stripe[c]; }, - getMaxNetworkRetries: function() { + getMaxNetworkRetries() { return this.getApiField('maxNetworkRetries'); }, - setMaxNetworkRetries: function(maxNetworkRetries) { - if ((maxNetworkRetries && typeof maxNetworkRetries !== 'number') || arguments.length < 1) { + setMaxNetworkRetries(maxNetworkRetries) { + if ( + (maxNetworkRetries && typeof maxNetworkRetries !== 'number') || + arguments.length < 1 + ) { throw new Error('maxNetworkRetries must be a number.'); } this._setApiField('maxNetworkRetries', maxNetworkRetries); }, - getMaxNetworkRetryDelay: function() { + getMaxNetworkRetryDelay() { return this.getConstant('MAX_NETWORK_RETRY_DELAY_SEC'); }, - getInitialNetworkRetryDelay: function() { + getInitialNetworkRetryDelay() { return this.getConstant('INITIAL_NETWORK_RETRY_DELAY_SEC'); }, // Gets a JSON version of a User-Agent and uses a cached version for a slight // speed advantage. - getClientUserAgent: function(cb) { + getClientUserAgent(cb) { if (Stripe.USER_AGENT_SERIALIZED) { return cb(Stripe.USER_AGENT_SERIALIZED); } - this.getClientUserAgentSeeded(Stripe.USER_AGENT, function(cua) { + this.getClientUserAgentSeeded(Stripe.USER_AGENT, (cua) => { Stripe.USER_AGENT_SERIALIZED = cua; cb(Stripe.USER_AGENT_SERIALIZED); - }) + }); }, // Gets a JSON version of a User-Agent by encoding a seeded object and // fetching a uname from the system. - getClientUserAgentSeeded: function(seed, cb) { - var self = this; - - utils.safeExec('uname -a', function(err, uname) { - var userAgent = {}; - for (var field in seed) { + getClientUserAgentSeeded(seed, cb) { + utils.safeExec('uname -a', (err, uname) => { + const userAgent = {}; + for (const field in seed) { userAgent[field] = encodeURIComponent(seed[field]); } // URI-encode in case there are unusual characters in the system's uname. userAgent.uname = encodeURIComponent(uname || 'UNKNOWN'); - if (self._appInfo) { - userAgent.application = self._appInfo; + if (this._appInfo) { + userAgent.application = this._appInfo; } - cb(JSON.stringify(userAgent)) + cb(JSON.stringify(userAgent)); }); }, - getAppInfoAsString: function() { + getAppInfoAsString() { if (!this._appInfo) { return ''; } - var formatted = this._appInfo.name; + let formatted = this._appInfo.name; if (this._appInfo.version) { - formatted += '/' + this._appInfo.version; + formatted += `/${this._appInfo.version}`; } if (this._appInfo.url) { - formatted += ' (' + this._appInfo.url + ')'; + formatted += ` (${this._appInfo.url})`; } return formatted; }, - setTelemetryEnabled: function(enableTelemetry) { + setTelemetryEnabled(enableTelemetry) { this._enableTelemetry = enableTelemetry; }, - getTelemetryEnabled: function() { + getTelemetryEnabled() { return this._enableTelemetry; }, - _prepResources: function() { - for (var name in resources) { + _prepResources() { + for (const name in resources) { this[utils.pascalToCamelCase(name)] = new resources[name](this); } }, diff --git a/lib/utils.js b/lib/utils.js index d74ea0f432..ae8ddfd778 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,38 +1,46 @@ 'use strict'; -var Buffer = require('safe-buffer').Buffer; -var EventEmitter = require('events').EventEmitter; -var exec = require('child_process').exec; -var qs = require('qs'); -var crypto = require('crypto'); - -var hasOwn = {}.hasOwnProperty; -var isPlainObject = require('lodash.isplainobject'); - -var OPTIONS_KEYS = ['api_key', 'idempotency_key', 'stripe_account', 'stripe_version']; - -var utils = module.exports = { - - isAuthKey: function(key) { +const Buffer = require('safe-buffer').Buffer; +const EventEmitter = require('events').EventEmitter; +const exec = require('child_process').exec; +const qs = require('qs'); +const crypto = require('crypto'); + +const hasOwn = {}.hasOwnProperty; +const isPlainObject = require('lodash.isplainobject'); + +const OPTIONS_KEYS = [ + 'api_key', + 'idempotency_key', + 'stripe_account', + 'stripe_version', +]; + +const utils = (module.exports = { + isAuthKey: (key) => { return typeof key == 'string' && /^(?:[a-z]{2}_)?[A-z0-9]{32}$/.test(key); }, - isOptionsHash: function(o) { - return isPlainObject(o) && OPTIONS_KEYS.some(function(key) { - return hasOwn.call(o, key); - }); + isOptionsHash: (o) => { + return isPlainObject(o) && OPTIONS_KEYS.some((key) => hasOwn.call(o, key)); }, /** * Stringifies an Object, accommodating nested objects * (forming the conventional key 'parent[child]=value') */ - stringifyRequestData: function(data) { - return qs.stringify(data, {serializeDate: function (d) { return Math.floor(d.getTime() / 1000); }}) - // Don't use strict form encoding by changing the square bracket control - // characters back to their literals. This is fine by the server, and - // makes these parameter strings easier to read. - .replace(/%5B/g, '[').replace(/%5D/g, ']'); + stringifyRequestData: (data) => { + return ( + qs + .stringify(data, { + serializeDate: (d) => Math.floor(d.getTime() / 1000), + }) + // Don't use strict form encoding by changing the square bracket control + // characters back to their literals. This is fine by the server, and + // makes these parameter strings easier to read. + .replace(/%5B/g, '[') + .replace(/%5D/g, ']') + ); }, /** @@ -41,27 +49,27 @@ var utils = module.exports = { * var fn = makeURLInterpolator('some/url/{param1}/{param2}'); * fn({ param1: 123, param2: 456 }); // => 'some/url/123/456' */ - makeURLInterpolator: (function() { - var rc = { - '\n': '\\n', '\"': '\\\"', - '\u2028': '\\u2028', '\u2029': '\\u2029', + makeURLInterpolator: (() => { + const rc = { + '\n': '\\n', + '"': '\\"', + '\u2028': '\\u2028', + '\u2029': '\\u2029', }; - return function makeURLInterpolator(str) { - var cleanString = str.replace(/["\n\r\u2028\u2029]/g, function($0) { - return rc[$0]; - }); - return function(outputs) { - return cleanString.replace(/\{([\s\S]+?)\}/g, function($0, $1) { - return encodeURIComponent(outputs[$1] || ''); - }); + return (str) => { + const cleanString = str.replace(/["\n\r\u2028\u2029]/g, ($0) => rc[$0]); + return (outputs) => { + return cleanString.replace(/\{([\s\S]+?)\}/g, ($0, $1) => + encodeURIComponent(outputs[$1] || '') + ); }; }; - }()), + })(), /** * Return the data argument from a list of arguments */ - getDataFromArgs: function(args) { + getDataFromArgs: (args) => { if (args.length < 1 || !isPlainObject(args[0])) { return {}; } @@ -70,20 +78,24 @@ var utils = module.exports = { return args.shift(); } - var argKeys = Object.keys(args[0]); + const argKeys = Object.keys(args[0]); - var optionKeysInArgs = argKeys.filter(function(key) { - return OPTIONS_KEYS.indexOf(key) > -1; - }); + const optionKeysInArgs = argKeys.filter((key) => + OPTIONS_KEYS.includes(key) + ); // In some cases options may be the provided as the first argument. // Here we're detecting a case where there are two distinct arguments // (the first being args and the second options) and with known // option keys in the first so that we can warn the user about it. - if (optionKeysInArgs.length > 0 && optionKeysInArgs.length !== argKeys.length) { + if ( + optionKeysInArgs.length > 0 && + optionKeysInArgs.length !== argKeys.length + ) { emitWarning( - 'Options found in arguments (' + optionKeysInArgs.join(', ') + '). Did you mean to pass an options ' + - 'object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.' + `Options found in arguments (${optionKeysInArgs.join( + ', ' + )}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.` ); } @@ -93,24 +105,26 @@ var utils = module.exports = { /** * Return the options hash from a list of arguments */ - getOptionsFromArgs: function(args) { - var opts = { + getOptionsFromArgs: (args) => { + const opts = { auth: null, headers: {}, }; if (args.length > 0) { - var arg = args[args.length - 1]; + const arg = args[args.length - 1]; if (utils.isAuthKey(arg)) { opts.auth = args.pop(); } else if (utils.isOptionsHash(arg)) { - var params = args.pop(); + const params = args.pop(); - var extraKeys = Object.keys(params).filter(function(key) { - return OPTIONS_KEYS.indexOf(key) == -1; - }); + const extraKeys = Object.keys(params).filter( + (key) => !OPTIONS_KEYS.includes(key) + ); if (extraKeys.length) { - emitWarning('Invalid options found (' + extraKeys.join(', ') + '); ignoring.'); + emitWarning( + `Invalid options found (${extraKeys.join(', ')}); ignoring.` + ); } if (params.api_key) { @@ -133,11 +147,13 @@ var utils = module.exports = { /** * Provide simple "Class" extension mechanism */ - protoExtend: function(sub) { - var Super = this; - var Constructor = hasOwn.call(sub, 'constructor') ? sub.constructor : function() { - Super.apply(this, arguments); - }; + protoExtend(sub) { + const Super = this; + const Constructor = hasOwn.call(sub, 'constructor') + ? sub.constructor + : function(...args) { + Super.apply(this, args); + }; // This initialization logic is somewhat sensitive to be compatible with // divergent JS implementations like the one found in Qt. See here for more @@ -152,9 +168,9 @@ var utils = module.exports = { }, /** - * Secure compare, from https://github.com/freewil/scmp - */ - secureCompare: function(a, b) { + * Secure compare, from https://github.com/freewil/scmp + */ + secureCompare: (a, b) => { a = Buffer.from(a); b = Buffer.from(b); @@ -170,24 +186,24 @@ var utils = module.exports = { return crypto.timingSafeEqual(a, b); } - var len = a.length; - var result = 0; + const len = a.length; + let result = 0; - for (var i = 0; i < len; ++i) { + for (let i = 0; i < len; ++i) { result |= a[i] ^ b[i]; } return result === 0; }, /** - * Remove empty values from an object - */ - removeEmpty: function(obj) { + * Remove empty values from an object + */ + removeEmpty: (obj) => { if (typeof obj !== 'object') { throw new Error('Argument must be an object'); } - Object.keys(obj).forEach(function(key) { + Object.keys(obj).forEach((key) => { if (obj[key] === null || obj[key] === undefined) { delete obj[key]; } @@ -197,24 +213,31 @@ var utils = module.exports = { }, /** - * Determine if file data is a derivative of EventEmitter class. - * https://nodejs.org/api/events.html#events_events - */ - checkForStream: function (obj) { + * Determine if file data is a derivative of EventEmitter class. + * https://nodejs.org/api/events.html#events_events + */ + checkForStream: (obj) => { if (obj.file && obj.file.data) { return obj.file.data instanceof EventEmitter; } return false; }, - callbackifyPromiseWithTimeout: function(promise, callback) { + callbackifyPromiseWithTimeout: (promise, callback) => { if (callback) { // Ensure callback is called outside of promise stack. - return promise.then(function(res) { - setTimeout(function() { callback(null, res) }, 0); - }, function(err) { - setTimeout(function() { callback(err, null); }, 0); - }); + return promise.then( + (res) => { + setTimeout(() => { + callback(null, res); + }, 0); + }, + (err) => { + setTimeout(() => { + callback(err, null); + }, 0); + } + ); } return promise; @@ -223,7 +246,7 @@ var utils = module.exports = { /** * Allow for special capitalization cases (such as OAuth) */ - pascalToCamelCase: function(name) { + pascalToCamelCase: (name) => { if (name === 'OAuth') { return 'oauth'; } else { @@ -231,7 +254,7 @@ var utils = module.exports = { } }, - emitWarning: emitWarning, + emitWarning, /** * Node's built in `exec` function sometimes throws outright, @@ -240,7 +263,7 @@ var utils = module.exports = { * * This unifies that interface. */ - safeExec: function safeExec(cmd, cb) { + safeExec: (cmd, cb) => { try { utils._exec(cmd, cb); } catch (e) { @@ -251,20 +274,20 @@ var utils = module.exports = { // For mocking in tests. _exec: exec, - isObject: function isObject(obj) { - var type = typeof obj; + isObject: (obj) => { + const type = typeof obj; return (type === 'function' || type === 'object') && !!obj; }, // For use in multipart requests - flattenAndStringify: function flattenAndStringify(data) { - var result = {}; + flattenAndStringify: (data) => { + const result = {}; - function step(obj, prevKey) { - Object.keys(obj).forEach(function (key) { - var value = obj[key]; + const step = (obj, prevKey) => { + Object.keys(obj).forEach((key) => { + const value = obj[key]; - var newKey = prevKey ? `${prevKey}[${key}]` : key; + const newKey = prevKey ? `${prevKey}[${key}]` : key; if (utils.isObject(value)) { if (!Buffer.isBuffer(value) && !value.hasOwnProperty('data')) { @@ -278,18 +301,20 @@ var utils = module.exports = { // Primitives are converted to strings result[newKey] = String(value); } - }) - } + }); + }; step(data); return result; }, -}; +}); function emitWarning(warning) { if (typeof process.emitWarning !== 'function') { - return console.warn('Stripe: ' + warning); /* eslint-disable-line no-console */ + return console.warn( + `Stripe: ${warning}` + ); /* eslint-disable-line no-console */ } return process.emitWarning(warning, 'Stripe'); diff --git a/package.json b/package.json index 6391631c2f..cb01587ae0 100644 --- a/package.json +++ b/package.json @@ -22,18 +22,23 @@ }, "bugs:": "https://github.com/stripe/stripe-node/issues", "engines": { - "node": ">=4" + "node": "6 || >=8.1" }, "main": "lib/stripe.js", "devDependencies": { + "babel-eslint": "^10.0.1", "chai": "~4.1.2", "chai-as-promised": "~7.1.1", "coveralls": "^3.0.0", - "eslint": "^4.19.1", + "eslint": "^5.16.0", + "eslint-config-prettier": "^4.1.0", + "eslint-plugin-flowtype": "^3.4.2", + "eslint-plugin-prettier": "^3.0.1", "eslint-plugin-chai-friendly": "^0.4.0", "mocha": "~5.0.5", "nock": "^9.0.0", - "nyc": "^11.3.0" + "nyc": "^11.3.0", + "prettier": "^1.16.4" }, "dependencies": { "lodash.isplainobject": "^4.0.6", @@ -45,9 +50,11 @@ "scripts": { "clean": "rm -rf ./.nyc_output ./node_modules/.cache ./coverage", "mocha": "nyc mocha", + "mocha-only": "mocha", "test": "npm run lint && npm run mocha", - "lint": "eslint .", + "lint": "eslint --ext .js,.jsx .", + "fix": "yarn lint --fix", "report": "nyc -r text -r lcov report", "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" } -} +} \ No newline at end of file diff --git a/test/Error.spec.js b/test/Error.spec.js index ff8f649eff..91b7ad9bc6 100644 --- a/test/Error.spec.js +++ b/test/Error.spec.js @@ -2,40 +2,55 @@ require('../testUtils'); -var Error = require('../lib/Error'); -var expect = require('chai').expect; +const Error = require('../lib/Error'); +const expect = require('chai').expect; -describe('Error', function() { - it('Populates with type and message params', function() { - var e = new Error('FooError', 'Foo happened'); +describe('Error', () => { + it('Populates with type and message params', () => { + const e = new Error('FooError', 'Foo happened'); expect(e).to.have.property('type', 'FooError'); expect(e).to.have.property('message', 'Foo happened'); expect(e).to.have.property('stack'); }); - describe('StripeError', function() { - it('Generates specific instance depending on error-type', function() { - expect(Error.StripeError.generate({type: 'card_error'})).to.be.instanceOf(Error.StripeCardError); - expect(Error.StripeError.generate({type: 'invalid_request_error'})).to.be.instanceOf( - Error.StripeInvalidRequestError + describe('StripeError', () => { + it('Generates specific instance depending on error-type', () => { + expect(Error.StripeError.generate({type: 'card_error'})).to.be.instanceOf( + Error.StripeCardError ); - expect(Error.StripeError.generate({type: 'api_error'})).to.be.instanceOf(Error.StripeAPIError); - expect(Error.StripeError.generate({type: 'idempotency_error'})).to.be.instanceOf(Error.StripeIdempotencyError); + expect( + Error.StripeError.generate({type: 'invalid_request_error'}) + ).to.be.instanceOf(Error.StripeInvalidRequestError); + expect(Error.StripeError.generate({type: 'api_error'})).to.be.instanceOf( + Error.StripeAPIError + ); + expect( + Error.StripeError.generate({type: 'idempotency_error'}) + ).to.be.instanceOf(Error.StripeIdempotencyError); }); - it('Pulls in headers', function() { - var headers = {'Request-Id': '123'}; - var e = Error.StripeError.generate({type: 'card_error', headers: headers}); + it('Pulls in headers', () => { + const headers = {'Request-Id': '123'}; + const e = Error.StripeError.generate({ + type: 'card_error', + headers, + }); expect(e).to.have.property('headers', headers); }); - it('Pulls in request IDs', function() { - var e = Error.StripeError.generate({type: 'card_error', requestId: 'foo'}); + it('Pulls in request IDs', () => { + const e = Error.StripeError.generate({ + type: 'card_error', + requestId: 'foo', + }); expect(e).to.have.property('requestId', 'foo'); }); - it('Pulls in HTTP status code', function() { - var e = Error.StripeError.generate({type: 'card_error', statusCode: 400}); + it('Pulls in HTTP status code', () => { + const e = Error.StripeError.generate({ + type: 'card_error', + statusCode: 400, + }); expect(e).to.have.property('statusCode', 400); }); }); diff --git a/test/StripeResource.spec.js b/test/StripeResource.spec.js index 7b19d898a5..9290bcc304 100644 --- a/test/StripeResource.spec.js +++ b/test/StripeResource.spec.js @@ -1,52 +1,56 @@ 'use strict'; -var utils = require('../testUtils'); -var uuid = require('uuid/v4'); +const utils = require('../testUtils'); +const uuid = require('uuid/v4'); -var nock = require('nock'); +const nock = require('nock'); -var stripe = require('../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('StripeResource', function() { - describe('createResourcePathWithSymbols', function() { - it('Generates a path', function() { +describe('StripeResource', () => { + describe('createResourcePathWithSymbols', () => { + it('Generates a path', () => { stripe.invoices.create({}); - var path = stripe.invoices.createResourcePathWithSymbols('{id}'); + const path = stripe.invoices.createResourcePathWithSymbols('{id}'); expect(path).to.equal('/invoices/{id}'); }); }); - describe('_defaultHeaders', function() { - it('sets the Authorization header with Bearer auth using the global API key', function() { - var headers = stripe.invoices._defaultHeaders(null, 0, null); + describe('_defaultHeaders', () => { + it('sets the Authorization header with Bearer auth using the global API key', () => { + const headers = stripe.invoices._defaultHeaders(null, 0, null); expect(headers.Authorization).to.equal('Bearer fakeAuthToken'); }); - it('sets the Authorization header with Bearer auth using the specified API key', function() { - var headers = stripe.invoices._defaultHeaders('anotherFakeAuthToken', 0, null); + it('sets the Authorization header with Bearer auth using the specified API key', () => { + const headers = stripe.invoices._defaultHeaders( + 'anotherFakeAuthToken', + 0, + null + ); expect(headers.Authorization).to.equal('Bearer anotherFakeAuthToken'); }); - it('sets the Stripe-Version header if an API version is provided', function() { - var headers = stripe.invoices._defaultHeaders(null, 0, '1970-01-01'); + it('sets the Stripe-Version header if an API version is provided', () => { + const headers = stripe.invoices._defaultHeaders(null, 0, '1970-01-01'); expect(headers['Stripe-Version']).to.equal('1970-01-01'); }); - it('does not the set the Stripe-Version header if no API version is provided', function() { - var headers = stripe.invoices._defaultHeaders(null, 0, null); + it('does not the set the Stripe-Version header if no API version is provided', () => { + const headers = stripe.invoices._defaultHeaders(null, 0, null); expect(headers).to.not.include.keys('Stripe-Version'); }); }); - describe('Parameter encoding', function() { + describe('Parameter encoding', () => { // Use a real instance of stripe as we're mocking the http.request responses. - var realStripe = require('../lib/stripe')(utils.getUserStripeKey()); + const realStripe = require('../lib/stripe')(utils.getUserStripeKey()); - after(function() { + after(() => { nock.cleanAll(); - }) + }); - describe('_request', function() { - it('encodes the query string in GET requests', function(done) { - var options = { + describe('_request', () => { + it('encodes the query string in GET requests', (done) => { + const options = { host: stripe.getConstant('DEFAULT_HOST'), path: '/v1/invoices/upcoming', data: { @@ -57,88 +61,92 @@ describe('StripeResource', function() { }, }; - const scope = nock('https://' + options.host) + const scope = nock(`https://${options.host}`) .get(options.path) .query(Object.assign({customer: 'cus_123'}, options.data)) .reply(200, '{}'); - realStripe.invoices.retrieveUpcoming('cus_123', options.data, function(err, response) { - done(); - scope.done(); - }); + realStripe.invoices.retrieveUpcoming( + 'cus_123', + options.data, + (err, response) => { + done(); + scope.done(); + } + ); }); - it('encodes the body in POST requests', function(done) { - var options = { + it('encodes the body in POST requests', (done) => { + const options = { host: stripe.getConstant('DEFAULT_HOST'), path: '/v1/subscriptions/sub_123', data: { customer: 'cus_123', - items: [ - {plan: 'foo', quantity: 2}, - {id: 'si_123', deleted: true}, - ], + items: [{plan: 'foo', quantity: 2}, {id: 'si_123', deleted: true}], }, - body: 'customer=cus_123&items[0][plan]=foo&items[0][quantity]=2&items[1][id]=si_123&items[1][deleted]=true', + body: + 'customer=cus_123&items[0][plan]=foo&items[0][quantity]=2&items[1][id]=si_123&items[1][deleted]=true', }; - const scope = nock('https://' + options.host) + const scope = nock(`https://${options.host}`) .post(options.path, options.body) .reply(200, '{}'); - realStripe.subscriptions.update('sub_123', options.data, function(err, response) { - done(); - scope.done(); - }); + realStripe.subscriptions.update( + 'sub_123', + options.data, + (err, response) => { + done(); + scope.done(); + } + ); }); }); }); - describe('Retry Network Requests', function() { + describe('Retry Network Requests', () => { // Use a real instance of stripe as we're mocking the http.request responses. - var realStripe = require('../lib/stripe')(utils.getUserStripeKey()); + const realStripe = require('../lib/stripe')(utils.getUserStripeKey()); // Override the sleep timer to speed up tests - realStripe.charges._getSleepTimeInMS = function() { - return 0; - }; + realStripe.charges._getSleepTimeInMS = () => 0; - var options = { + const options = { host: stripe.getConstant('DEFAULT_HOST'), path: '/v1/charges', data: { amount: 1000, currency: 'usd', source: 'tok_visa', - description: 'test' + description: 'test', }, - params: 'amount=1000¤cy=usd&source=tok_visa&description=test' + params: 'amount=1000¤cy=usd&source=tok_visa&description=test', }; - afterEach(function() { + afterEach(() => { realStripe.setMaxNetworkRetries(0); stripe.setMaxNetworkRetries(0); }); - after(function() { + after(() => { nock.cleanAll(); - }) + }); - describe('_request', function() { - it('throws an error on connection failure', function(done) { + describe('_request', () => { + it('throws an error on connection failure', (done) => { // Mock the connection error. - nock('https://' + options.host) + nock(`https://${options.host}`) .post(options.path, options.params) .replyWithError('bad stuff'); - realStripe.charges.create(options.data, function(err) { + realStripe.charges.create(options.data, (err) => { expect(err.detail.message).to.deep.equal('bad stuff'); done(); }); }); - it('should retry the request if max retries are set', function(done) { - nock('https://' + options.host) + it('should retry the request if max retries are set', (done) => { + nock(`https://${options.host}`) .post(options.path, options.params) .replyWithError('bad stuff') .post(options.path, options.params) @@ -146,16 +154,18 @@ describe('StripeResource', function() { realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, function(err) { - var errorMessage = realStripe.invoices._generateConnectionErrorMessage(1); + realStripe.charges.create(options.data, (err) => { + const errorMessage = realStripe.invoices._generateConnectionErrorMessage( + 1 + ); expect(err.message).to.equal(errorMessage); expect(err.detail.message).to.deep.equal('worse stuff'); done(); }); }); - it('should stop retrying after a successful retry', function(done) { - nock('https://' + options.host) + it('should stop retrying after a successful retry', (done) => { + nock(`https://${options.host}`) .post(options.path, options.params) .replyWithError('bad stuff') .post(options.path, options.params) @@ -167,19 +177,19 @@ describe('StripeResource', function() { realStripe.setMaxNetworkRetries(2); - realStripe.charges.create(options.data, function(err, charge) { + realStripe.charges.create(options.data, (err, charge) => { expect(charge.id).to.equal('ch_123'); done(); }); }); - it('should retry on a 409 error', function(done) { - nock('https://' + options.host) + it('should retry on a 409 error', (done) => { + nock(`https://${options.host}`) .post(options.path, options.params) .reply(409, { error: { - message: 'Conflict' - } + message: 'Conflict', + }, }) .post(options.path, options.params) .reply(200, { @@ -190,69 +200,70 @@ describe('StripeResource', function() { realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, function(err, charge) { + realStripe.charges.create(options.data, (err, charge) => { expect(charge.id).to.equal('ch_123'); done(); }); }); - it('should not retry on a 400 error', function(done) { - nock('https://' + options.host) + it('should not retry on a 400 error', (done) => { + nock(`https://${options.host}`) .post(options.path, options.params) .reply(400, { error: { - type: 'card_error' - } + type: 'card_error', + }, }); realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, function(err) { + realStripe.charges.create(options.data, (err) => { expect(err.type).to.equal('StripeCardError'); done(); }); }); - it('should not retry on a 500 error when the method is POST', function(done) { - nock('https://' + options.host) + it('should not retry on a 500 error when the method is POST', (done) => { + nock(`https://${options.host}`) .post(options.path, options.params) .reply(500, { error: { - type: 'api_error' - } + type: 'api_error', + }, }); realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, function(err) { + realStripe.charges.create(options.data, (err) => { expect(err.type).to.equal('StripeAPIError'); done(); }); }); - it('should handle OAuth errors gracefully', function (done) { + it('should handle OAuth errors gracefully', (done) => { nock('https://connect.stripe.com') .post('/oauth/token') .reply(400, { error: 'invalid_grant', - error_description: 'This authorization code has already been used. All tokens issued with this code have been revoked.' + error_description: + 'This authorization code has already been used. All tokens issued with this code have been revoked.', }); realStripe.setMaxNetworkRetries(1); - realStripe.oauth.token(options.data, function (err) { + realStripe.oauth.token(options.data, (err) => { expect(err.type).to.equal('StripeInvalidGrantError'); done(); }); }); - it('should retry on a 503 error when the method is POST', function(done) { - nock('https://' + options.host) + it('should retry on a 503 error when the method is POST', (done) => { + nock(`https://${options.host}`) .post(options.path, options.params) .reply(503, { error: { - message: 'Service unavailable' - } + message: 'Service unavailable', + }, }) .post(options.path, options.params) .reply(200, { @@ -263,21 +274,21 @@ describe('StripeResource', function() { realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, function(err, charge) { + realStripe.charges.create(options.data, (err, charge) => { expect(charge.id).to.equal('ch_123'); done(); }); }); - it('should retry on a 500 error when the method is GET', function(done) { - nock('https://' + options.host) - .get(options.path + '/ch_123') + it('should retry on a 500 error when the method is GET', (done) => { + nock(`https://${options.host}`) + .get(`${options.path}/ch_123`) .reply(500, { error: { - type: 'api_error' - } + type: 'api_error', + }, }) - .get(options.path + '/ch_123') + .get(`${options.path}/ch_123`) .reply(200, { id: 'ch_123', object: 'charge', @@ -286,144 +297,168 @@ describe('StripeResource', function() { realStripe.setMaxNetworkRetries(1); - realStripe.charges.retrieve('ch_123', function(err, charge) { + realStripe.charges.retrieve('ch_123', (err, charge) => { expect(charge.id).to.equal('ch_123'); done(); }); }); - it('should add an idempotency key for retries using the POST method', function(done) { - var headers; + it('should add an idempotency key for retries using the POST method', (done) => { + let headers; // Fail the first request but succeed on the 2nd. - nock('https://' + options.host) + nock(`https://${options.host}`) .post(options.path, options.params) .replyWithError('bad stuff') .post(options.path, options.params) .reply(function(uri, requestBody, cb) { headers = this.req.headers; - return cb(null, [200, { - id: 'ch_123"', - object: 'charge', - amount: 1000, - }]); + return cb(null, [ + 200, + { + id: 'ch_123"', + object: 'charge', + amount: 1000, + }, + ]); }); realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, function() { + realStripe.charges.create(options.data, () => { expect(headers).to.have.property('idempotency-key'); done(); }); }); - it('should not add idempotency key for retries using the GET method', function(done) { - var headers; + it('should not add idempotency key for retries using the GET method', (done) => { + let headers; - nock('https://' + options.host) - .get(options.path + '/ch_123') + nock(`https://${options.host}`) + .get(`${options.path}/ch_123`) .replyWithError('bad stuff') - .get(options.path + '/ch_123') + .get(`${options.path}/ch_123`) .reply(function(uri, requestBody, cb) { headers = this.req.headers; - return cb(null, [200, { - id: 'ch_123"', - object: 'charge', - amount: 1000, - }]); + return cb(null, [ + 200, + { + id: 'ch_123"', + object: 'charge', + amount: 1000, + }, + ]); }); realStripe.setMaxNetworkRetries(1); - realStripe.charges.retrieve('ch_123', function() { + realStripe.charges.retrieve('ch_123', () => { expect(headers).to.not.have.property('idempotency-key'); done(); }); }); - it('should reuse the given idempotency key provided for retries', function(done) { - var key = uuid(); - var headers; + it('should reuse the given idempotency key provided for retries', (done) => { + const key = uuid(); + let headers; - nock('https://' + options.host) + nock(`https://${options.host}`) .post(options.path, options.params) .replyWithError('bad stuff') .post(options.path, options.params) .reply(function(uri, requestBody, cb) { headers = this.req.headers; - return cb(null, [200, { - id: 'ch_123"', - object: 'charge', - amount: 1000, - }]); + return cb(null, [ + 200, + { + id: 'ch_123"', + object: 'charge', + amount: 1000, + }, + ]); }); realStripe.setMaxNetworkRetries(1); - realStripe.charges.create(options.data, {idempotency_key: key}, function() { + realStripe.charges.create(options.data, {idempotency_key: key}, () => { expect(headers['idempotency-key']).to.equal(key); done(); }); }); }); - describe('_shouldRetry', function() { - it('should return false if we\'ve reached maximum retries', function() { + describe('_shouldRetry', () => { + it("should return false if we've reached maximum retries", () => { stripe.setMaxNetworkRetries(1); - var res = stripe.invoices._shouldRetry({ - statusCode: 409 - }, 1); + const res = stripe.invoices._shouldRetry( + { + statusCode: 409, + }, + 1 + ); expect(res).to.equal(false); }); - it('should return true if we have more retries available', function() { + it('should return true if we have more retries available', () => { stripe.setMaxNetworkRetries(1); - var res = stripe.invoices._shouldRetry({ - statusCode: 409 - }, 0); + const res = stripe.invoices._shouldRetry( + { + statusCode: 409, + }, + 0 + ); expect(res).to.equal(true); }); - it('should return true if the error code is either 409 or 503', function() { + it('should return true if the error code is either 409 or 503', () => { stripe.setMaxNetworkRetries(1); - var res = stripe.invoices._shouldRetry({ - statusCode: 409 - }, 0); + let res = stripe.invoices._shouldRetry( + { + statusCode: 409, + }, + 0 + ); expect(res).to.equal(true); - res = stripe.invoices._shouldRetry({ - statusCode: 503 - }, 0); + res = stripe.invoices._shouldRetry( + { + statusCode: 503, + }, + 0 + ); expect(res).to.equal(true); }); - it('should return false if the status is 200', function() { + it('should return false if the status is 200', () => { stripe.setMaxNetworkRetries(2); // mocking that we're on our 2nd request - var res = stripe.invoices._shouldRetry({ - statusCode: 200, - req: {_requestEvent: {method: 'POST'}} - }, 1); + const res = stripe.invoices._shouldRetry( + { + statusCode: 200, + req: {_requestEvent: {method: 'POST'}}, + }, + 1 + ); expect(res).to.equal(false); }); }); - describe('_getSleepTimeInMS', function() { - it('should not exceed the maximum or minimum values', function() { - var sleepSeconds; - var max = stripe.getMaxNetworkRetryDelay(); - var min = stripe.getInitialNetworkRetryDelay(); + describe('_getSleepTimeInMS', () => { + it('should not exceed the maximum or minimum values', () => { + let sleepSeconds; + const max = stripe.getMaxNetworkRetryDelay(); + const min = stripe.getInitialNetworkRetryDelay(); - for (var i = 0; i < 10; i++) { + for (let i = 0; i < 10; i++) { sleepSeconds = stripe.invoices._getSleepTimeInMS(i) / 1000; expect(sleepSeconds).to.be.at.most(max); diff --git a/test/Webhook.spec.js b/test/Webhook.spec.js index 9576888d59..23344013c0 100644 --- a/test/Webhook.spec.js +++ b/test/Webhook.spec.js @@ -1,138 +1,206 @@ 'use strict'; -var stripe = require('../testUtils').getSpyableStripe(); -var expect = require('chai').expect; -var Buffer = require('safe-buffer').Buffer; +const stripe = require('../testUtils').getSpyableStripe(); +const expect = require('chai').expect; +const Buffer = require('safe-buffer').Buffer; -var EVENT_PAYLOAD = { +const EVENT_PAYLOAD = { id: 'evt_test_webhook', object: 'event', }; -var EVENT_PAYLOAD_STRING = JSON.stringify(EVENT_PAYLOAD, null, 2); +const EVENT_PAYLOAD_STRING = JSON.stringify(EVENT_PAYLOAD, null, 2); -var SECRET = 'whsec_test_secret'; +const SECRET = 'whsec_test_secret'; -describe('Webhooks', function() { - describe('.constructEvent', function() { - it('should return an Event instance from a valid JSON payload and valid signature header', function() { - var header = generateHeaderString({ +describe('Webhooks', () => { + describe('.constructEvent', () => { + it('should return an Event instance from a valid JSON payload and valid signature header', () => { + const header = generateHeaderString({ payload: EVENT_PAYLOAD_STRING, }); - var event = stripe.webhooks.constructEvent(EVENT_PAYLOAD_STRING, header, SECRET); + const event = stripe.webhooks.constructEvent( + EVENT_PAYLOAD_STRING, + header, + SECRET + ); expect(event.id).to.equal(EVENT_PAYLOAD.id); }); - it('should raise a JSON error from invalid JSON payload', - function() { - var header = generateHeaderString({ - payload: '} I am not valid JSON; 123][', - }); - expect(function() { - stripe.webhooks.constructEvent('} I am not valid JSON; 123][', header, SECRET); - }).to.throw(/Unexpected token/); + it('should raise a JSON error from invalid JSON payload', () => { + const header = generateHeaderString({ + payload: '} I am not valid JSON; 123][', }); + expect(() => { + stripe.webhooks.constructEvent( + '} I am not valid JSON; 123][', + header, + SECRET + ); + }).to.throw(/Unexpected token/); + }); - it('should raise a SignatureVerificationError from a valid JSON payload and an invalid signature header', - function() { - var header = 'bad_header'; + it('should raise a SignatureVerificationError from a valid JSON payload and an invalid signature header', () => { + const header = 'bad_header'; - expect(function() { - stripe.webhooks.constructEvent(EVENT_PAYLOAD_STRING, header, SECRET); - }).to.throw(/Unable to extract timestamp and signatures from header/); - }); + expect(() => { + stripe.webhooks.constructEvent(EVENT_PAYLOAD_STRING, header, SECRET); + }).to.throw(/Unable to extract timestamp and signatures from header/); + }); }); - describe('.verifySignatureHeader', function() { - it('should raise a SignatureVerificationError when the header does not have the expected format', function() { - var header = "I'm not even a real signature header"; + describe('.verifySignatureHeader', () => { + it('should raise a SignatureVerificationError when the header does not have the expected format', () => { + const header = "I'm not even a real signature header"; - var expectedMessage = /Unable to extract timestamp and signatures from header/; + const expectedMessage = /Unable to extract timestamp and signatures from header/; - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET + ); }).to.throw(expectedMessage); - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, null, SECRET); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + null, + SECRET + ); }).to.throw(expectedMessage); - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, undefined, SECRET); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + undefined, + SECRET + ); }).to.throw(expectedMessage); - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, '', SECRET); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + '', + SECRET + ); }).to.throw(expectedMessage); }); - it('should raise a SignatureVerificationError when there are no signatures with the expected scheme', function() { - var header = generateHeaderString({ + it('should raise a SignatureVerificationError when there are no signatures with the expected scheme', () => { + const header = generateHeaderString({ scheme: 'v0', }); - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET + ); }).to.throw(/No signatures found with expected scheme/); }); - it('should raise a SignatureVerificationError when there are no valid signatures for the payload', function() { - var header = generateHeaderString({ + it('should raise a SignatureVerificationError when there are no valid signatures for the payload', () => { + const header = generateHeaderString({ signature: 'bad_signature', }); - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET); - }).to.throw(/No signatures found matching the expected signature for payload/); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET + ); + }).to.throw( + /No signatures found matching the expected signature for payload/ + ); }); - it('should raise a SignatureVerificationError when the timestamp is not within the tolerance', function() { - var header = generateHeaderString({ - timestamp: (Date.now() / 1000) - 15, + it('should raise a SignatureVerificationError when the timestamp is not within the tolerance', () => { + const header = generateHeaderString({ + timestamp: Date.now() / 1000 - 15, }); - expect(function() { - stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET, 10); + expect(() => { + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET, + 10 + ); }).to.throw(/Timestamp outside the tolerance zone/); }); - it('should return true when the header contains a valid signature and ' + - 'the timestamp is within the tolerance', - function() { - var header = generateHeaderString({ - timestamp: (Date.now() / 1000), - }); - - expect(stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET, 10)).to.equal(true); - }); + it( + 'should return true when the header contains a valid signature and ' + + 'the timestamp is within the tolerance', + () => { + const header = generateHeaderString({ + timestamp: Date.now() / 1000, + }); - it('should return true when the header contains at least one valid signature', function() { - var header = generateHeaderString({ - timestamp: (Date.now() / 1000), + expect( + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET, + 10 + ) + ).to.equal(true); + } + ); + + it('should return true when the header contains at least one valid signature', () => { + let header = generateHeaderString({ + timestamp: Date.now() / 1000, }); header += ',v1=potato'; - expect(stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET, 10)).to.equal(true); + expect( + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET, + 10 + ) + ).to.equal(true); }); - it('should return true when the header contains a valid signature ' + - 'and the timestamp is off but no tolerance is provided', - function() { - var header = generateHeaderString({ - timestamp: 12345, - }); - - expect(stripe.webhooks.signature.verifyHeader(EVENT_PAYLOAD_STRING, header, SECRET)).to.equal(true); - }); + it( + 'should return true when the header contains a valid signature ' + + 'and the timestamp is off but no tolerance is provided', + () => { + const header = generateHeaderString({ + timestamp: 12345, + }); - it('should accept Buffer instances for the payload and header', function() { - var header = generateHeaderString({ - timestamp: (Date.now() / 1000), + expect( + stripe.webhooks.signature.verifyHeader( + EVENT_PAYLOAD_STRING, + header, + SECRET + ) + ).to.equal(true); + } + ); + + it('should accept Buffer instances for the payload and header', () => { + const header = generateHeaderString({ + timestamp: Date.now() / 1000, }); - expect(stripe.webhooks.signature.verifyHeader(Buffer.from(EVENT_PAYLOAD_STRING), Buffer.from(header), SECRET, 10)).to.equal(true); + expect( + stripe.webhooks.signature.verifyHeader( + Buffer.from(EVENT_PAYLOAD_STRING), + Buffer.from(header), + SECRET, + 10 + ) + ).to.equal(true); }); }); }); @@ -145,12 +213,16 @@ function generateHeaderString(opts) { opts.secret = opts.secret || SECRET; opts.scheme = opts.scheme || stripe.webhooks.signature.EXPECTED_SCHEME; - opts.signature = opts.signature || - stripe.webhooks.signature._computeSignature(opts.timestamp + '.' + opts.payload, opts.secret); + opts.signature = + opts.signature || + stripe.webhooks.signature._computeSignature( + `${opts.timestamp}.${opts.payload}`, + opts.secret + ); - var generatedHeader = [ - 't=' + opts.timestamp, - opts.scheme + '=' + opts.signature, + const generatedHeader = [ + `t=${opts.timestamp}`, + `${opts.scheme}=${opts.signature}`, ].join(','); return generatedHeader; diff --git a/test/autoPagination.spec.js b/test/autoPagination.spec.js index 6674462d78..3cc3d9e35c 100644 --- a/test/autoPagination.spec.js +++ b/test/autoPagination.spec.js @@ -2,421 +2,485 @@ /* eslint-disable callback-return */ -var testUtils = require('../testUtils'); -var stripe = require('../lib/stripe')( - testUtils.getUserStripeKey(), - 'latest' -); +const testUtils = require('../testUtils'); +const stripe = require('../lib/stripe')(testUtils.getUserStripeKey(), 'latest'); -var expect = require('chai').expect; +const expect = require('chai').expect; -var LIMIT = 7; -var TOTAL_OBJECTS = 8; +const LIMIT = 7; +const TOTAL_OBJECTS = 8; describe('auto pagination', function() { this.timeout(20000); - var email = 'test.' + Date.now() + '@example.com'; - var realCustomerIds; - before(function() { - return new Promise(function(resolve) { - var createReqs = []; - for (var i = 0; i < TOTAL_OBJECTS; i++) { - createReqs.push(stripe.customers.create({email: email})); - } - return Promise.all(createReqs).then(function() { - // re-fetch to ensure correct order - return stripe.customers.list({email: email}).then(function(customers) { - realCustomerIds = customers.data.map(function(customer) {return customer.id}); - }) - }).then(resolve); - }); - }); - - after(function() { - return new Promise(function(resolve) { - Promise.all(realCustomerIds.map(function(customerId) { - return stripe.customers.del(customerId); - })).then(resolve); - }); - }); + const email = `test.${Date.now()}@example.com`; + let realCustomerIds; + before( + () => + new Promise((resolve) => { + const createReqs = []; + for (let i = 0; i < TOTAL_OBJECTS; i++) { + createReqs.push(stripe.customers.create({email})); + } + return Promise.all(createReqs) + .then(() => + // re-fetch to ensure correct order + stripe.customers.list({email}).then((customers) => { + realCustomerIds = customers.data.map((customer) => customer.id); + }) + ) + .then(resolve); + }) + ); + + after( + () => + new Promise((resolve) => { + Promise.all( + realCustomerIds.map((customerId) => stripe.customers.del(customerId)) + ).then(resolve); + }) + ); + + describe('callbacks', () => { + it('lets you call `next()` to iterate and `next(false)` to break', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + function onCustomer(customer, next) { + customerIds.push(customer.id); + if (customerIds.length === LIMIT) { + next(false); + } else { + expect(customerIds.length).to.be.lessThan(LIMIT); + next(); + } + } + function onDone(err) { + if (err) { + reject(err); + } else { + resolve(customerIds); + } + } - describe('callbacks', function() { - it('lets you call `next()` to iterate and `next(false)` to break', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - function onCustomer(customer, next) { - customerIds.push(customer.id); - if (customerIds.length === LIMIT) { - next(false); - } else { - expect(customerIds.length).to.be.lessThan(LIMIT); - next(); + stripe.customers + .list({limit: 3, email}) + .autoPagingEach(onCustomer, onDone); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + + it('lets you ignore the second arg and `return false` to break', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + function onCustomer(customer) { + customerIds.push(customer.id); + if (customerIds.length === LIMIT) { + return false; + } else { + expect(customerIds.length).to.be.lessThan(LIMIT); + } } - } - function onDone(err) { - if (err) { - reject(err); - } else { - resolve(customerIds); + function onDone(err) { + if (err) { + reject(err); + } else { + resolve(customerIds); + } } - } - stripe.customers.list({limit: 3, email: email}) - .autoPagingEach(onCustomer, onDone); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('lets you ignore the second arg and `return false` to break', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - function onCustomer(customer) { - customerIds.push(customer.id); - if (customerIds.length === LIMIT) { - return false; - } else { - expect(customerIds.length).to.be.lessThan(LIMIT); + stripe.customers + .list({limit: 3, email}) + .autoPagingEach(onCustomer, onDone); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + + it('lets you ignore the second arg and return a Promise which returns `false` to break', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + function onCustomer(customer) { + customerIds.push(customer.id); + if (customerIds.length === LIMIT) { + return Promise.resolve(false); + } else { + expect(customerIds.length).to.be.lessThan(LIMIT); + return Promise.resolve(); + } } - } - function onDone(err) { - if (err) { - reject(err); - } else { - resolve(customerIds); + function onDone(err) { + if (err) { + reject(err); + } else { + resolve(customerIds); + } } - } - stripe.customers.list({limit: 3, email: email}) - .autoPagingEach(onCustomer, onDone); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('lets you ignore the second arg and return a Promise which returns `false` to break', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - function onCustomer(customer) { - customerIds.push(customer.id); - if (customerIds.length === LIMIT) { - return Promise.resolve(false); - } else { - expect(customerIds.length).to.be.lessThan(LIMIT); - return Promise.resolve(); + stripe.customers + .list({limit: 3, email}) + .autoPagingEach(onCustomer, onDone); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + + it('can use a promise instead of a callback for onDone', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + function onCustomer(customer) { + customerIds.push(customer.id); } - } - function onDone(err) { - if (err) { - reject(err); - } else { + function onDone() { resolve(customerIds); } - } - - stripe.customers.list({limit: 3, email: email}) - .autoPagingEach(onCustomer, onDone); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('can use a promise instead of a callback for onDone', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - function onCustomer(customer) { - customerIds.push(customer.id); - } - function onDone() { - resolve(customerIds); - } - stripe.customers.list({limit: 3, email: email}) - .autoPagingEach(onCustomer) - .then(onDone) - .catch(reject); - })).to.eventually.deep.equal(realCustomerIds); - }); - - it('handles the end of a list properly when the last page is full', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - return stripe.customers.list({email: email, limit: TOTAL_OBJECTS / 2}) - .autoPagingEach(function(customer) { customerIds.push(customer.id); }) - .catch(reject) - .then(function() { - resolve(customerIds); - }); - })).to.eventually.deep.equal(realCustomerIds); - }); - - it('handles the end of a list properly when the last page is not full', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - return stripe.customers.list({email: email, limit: TOTAL_OBJECTS - 2}) - .autoPagingEach(function(customer) { customerIds.push(customer.id); }) - .catch(reject) - .then(function() { - resolve(customerIds); - }); - })).to.eventually.deep.equal(realCustomerIds); - }); - - it('handles a list which is shorter than the page size properly', function() { - return expect(new Promise(function(resolve, reject) { - var customerIds = []; - return stripe.customers.list({email: email, limit: TOTAL_OBJECTS + 2}) - .autoPagingEach(function(customer) { customerIds.push(customer.id); }) - .catch(reject) - .then(function() { - resolve(customerIds); - }); - })).to.eventually.deep.equal(realCustomerIds); - }); - - it('handles errors after the first page correctly (callback)', function() { - return expect(new Promise(function(resolve, reject) { - var i = 0; - function onCustomer() { - i += 1; - if (i > 4) { - throw Error('Simulated error'); + stripe.customers + .list({limit: 3, email}) + .autoPagingEach(onCustomer) + .then(onDone) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds)); + + it('handles the end of a list properly when the last page is full', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + return stripe.customers + .list({email, limit: TOTAL_OBJECTS / 2}) + .autoPagingEach((customer) => { + customerIds.push(customer.id); + }) + .catch(reject) + .then(() => { + resolve(customerIds); + }); + }) + ).to.eventually.deep.equal(realCustomerIds)); + + it('handles the end of a list properly when the last page is not full', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + return stripe.customers + .list({email, limit: TOTAL_OBJECTS - 2}) + .autoPagingEach((customer) => { + customerIds.push(customer.id); + }) + .catch(reject) + .then(() => { + resolve(customerIds); + }); + }) + ).to.eventually.deep.equal(realCustomerIds)); + + it('handles a list which is shorter than the page size properly', () => + expect( + new Promise((resolve, reject) => { + const customerIds = []; + return stripe.customers + .list({email, limit: TOTAL_OBJECTS + 2}) + .autoPagingEach((customer) => { + customerIds.push(customer.id); + }) + .catch(reject) + .then(() => { + resolve(customerIds); + }); + }) + ).to.eventually.deep.equal(realCustomerIds)); + + it('handles errors after the first page correctly (callback)', () => + expect( + new Promise((resolve, reject) => { + let i = 0; + function onCustomer() { + i += 1; + if (i > 4) { + throw Error('Simulated error'); + } } - } - return stripe.customers.list({email: email, limit: 3}) - .autoPagingEach(onCustomer, function(err) { - if (err) { - resolve(err.message); - } else { - reject(Error('Expected an error, did not get one.')); + return stripe.customers + .list({email, limit: 3}) + .autoPagingEach(onCustomer, (err) => { + if (err) { + resolve(err.message); + } else { + reject(Error('Expected an error, did not get one.')); + } + }); + }) + ).to.eventually.deep.equal('Simulated error')); + + it('handles errors after the first page correctly (promise)', () => + expect( + new Promise((resolve, reject) => { + let i = 0; + function onCustomer() { + i += 1; + if (i > 4) { + throw Error('Simulated error'); } - }); - })).to.eventually.deep.equal('Simulated error'); - }); - - it('handles errors after the first page correctly (promise)', function() { - return expect(new Promise(function(resolve, reject) { - var i = 0; - function onCustomer() { - i += 1; - if (i > 4) { - throw Error('Simulated error'); } - } - return stripe.customers.list({email: email, limit: 3}) - .autoPagingEach(onCustomer) - .then(function() { - reject(Error('Expected an error, did not get one.')); - }) - .catch(function(err) { - resolve(err.message); - }); - })).to.eventually.deep.equal('Simulated error'); - }); + return stripe.customers + .list({email, limit: 3}) + .autoPagingEach(onCustomer) + .then(() => { + reject(Error('Expected an error, did not get one.')); + }) + .catch((err) => { + resolve(err.message); + }); + }) + ).to.eventually.deep.equal('Simulated error')); }); - describe('async iterators', function() { - + describe('async iterators', () => { if (testUtils.envSupportsForAwait()) { // `for await` throws a syntax error everywhere but node 10, // so we must conditionally require it. - var forAwaitUntil = require('../testUtils/forAwait.node10').forAwaitUntil; - - it('works with `for await` when that feature exists (user break)', function() { - return expect(new Promise(function(resolve, reject) { - forAwaitUntil(stripe.customers.list({limit: 3, email: email}), LIMIT) - .then(function(customers) { - resolve(customers.map(function(customer) { return customer.id; })); - }) - .catch(reject) - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('works with `for await` when that feature exists (end of list)', function() { - return expect(new Promise(function(resolve, reject) { - forAwaitUntil(stripe.customers.list({limit: 3, email: email}), TOTAL_OBJECTS + 1) - .then(function(customers) { - resolve(customers.map(function(customer) { return customer.id; })); - }) - .catch(reject); - })).to.eventually.deep.equal(realCustomerIds); - }); + const forAwaitUntil = require('../testUtils/forAwait.node10') + .forAwaitUntil; + + it('works with `for await` when that feature exists (user break)', () => + expect( + new Promise((resolve, reject) => { + forAwaitUntil(stripe.customers.list({limit: 3, email}), LIMIT) + .then((customers) => { + resolve(customers.map((customer) => customer.id)); + }) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + + it('works with `for await` when that feature exists (end of list)', () => + expect( + new Promise((resolve, reject) => { + forAwaitUntil( + stripe.customers.list({limit: 3, email}), + TOTAL_OBJECTS + 1 + ) + .then((customers) => { + resolve(customers.map((customer) => customer.id)); + }) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds)); } if (testUtils.envSupportsAwait()) { // Similarly, `await` throws a syntax error below Node 7.6. - var awaitUntil = require('../testUtils/await.node7').awaitUntil; + const awaitUntil = require('../testUtils/await.node7').awaitUntil; + + it('works with `await` and a while loop when await exists', () => + expect( + new Promise((resolve, reject) => { + awaitUntil(stripe.customers.list({limit: 3, email}), LIMIT) + .then((customers) => { + resolve(customers.map((customer) => customer.id)); + }) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + } + + it('returns an empty object from .return() so that `break;` works in for-await', () => + expect( + new Promise((resolve, reject) => { + const iter = stripe.customers.list({limit: 3, email}); + + const customerIds = []; + function handleIter(result) { + customerIds.push(result.value.id); + expect(iter.return()).to.deep.equal({}); + } - it('works with `await` and a while loop when await exists', function() { - return expect(new Promise(function(resolve, reject) { - awaitUntil(stripe.customers.list({limit: 3, email: email}), LIMIT) - .then(function(customers) { - resolve(customers.map(function(customer) { return customer.id; })); + iter + .next() + .then(handleIter) + .then(() => { + resolve(customerIds); }) .catch(reject); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - } - - it('returns an empty object from .return() so that `break;` works in for-await', function() { - return expect(new Promise(function(resolve, reject) { - var iter = stripe.customers.list({limit: 3, email: email}); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, 1))); + + it('works when you call it sequentially', () => + expect( + new Promise((resolve, reject) => { + const iter = stripe.customers.list({limit: 3, email}); + + const customerIds = []; + function handleIter(result) { + customerIds.push(result.value.id); + if (customerIds.length < 7) { + return iter.next().then(handleIter); + } + } + iter + .next() + .then(handleIter) + .then(() => { + resolve(customerIds); + }) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); - var customerIds = []; - function handleIter(result) { - customerIds.push(result.value.id); - expect(iter.return()).to.deep.equal({}); - } + it('gives you the same result each time when you call it multiple times in parallel', () => + expect( + new Promise((resolve, reject) => { + const iter = stripe.customers.list({limit: 3, email}); - iter.next().then(handleIter).then(function() { - resolve(customerIds); - }).catch(reject); - })).to.eventually.deep.equal(realCustomerIds.slice(0, 1)); - }); - - it('works when you call it sequentially', function() { - return expect(new Promise(function(resolve, reject) { - var iter = stripe.customers.list({limit: 3, email: email}); - - var customerIds = []; - function handleIter(result) { - customerIds.push(result.value.id); - if (customerIds.length < 7) { - return iter.next().then(handleIter); + const customerIds = []; + function handleIter(result) { + customerIds.push(result.value.id); } - } - iter.next().then(handleIter).then(function() { - resolve(customerIds); - }).catch(reject); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('gives you the same result each time when you call it multiple times in parallel', function() { - return expect(new Promise(function(resolve, reject) { - var iter = stripe.customers.list({limit: 3, email: email}); - - var customerIds = [] - function handleIter(result) { - customerIds.push(result.value.id); - } - Promise.all([ - iter.next().then(handleIter), - iter.next().then(handleIter).then(function() { - return Promise.all([ - iter.next().then(handleIter), - iter.next().then(handleIter), - ]) - }).then(function() { - return Promise.all([ - iter.next().then(handleIter), - iter.next().then(handleIter), - ]) - }).then(function() { - return Promise.all([ - iter.next().then(handleIter), - iter.next().then(handleIter), - ]) - }) - ]).then(function() { - resolve(customerIds); - }).catch(reject); - })).to.eventually.deep.equal(realCustomerIds.slice(0, 4).reduce(function(acc, x) { - acc.push(x); - acc.push(x); - return acc; - }, [])); - }); + Promise.all([ + iter.next().then(handleIter), + iter + .next() + .then(handleIter) + .then(() => + Promise.all([ + iter.next().then(handleIter), + iter.next().then(handleIter), + ]) + ) + .then(() => + Promise.all([ + iter.next().then(handleIter), + iter.next().then(handleIter), + ]) + ) + .then(() => + Promise.all([ + iter.next().then(handleIter), + iter.next().then(handleIter), + ]) + ), + ]) + .then(() => { + resolve(customerIds); + }) + .catch(reject); + }) + ).to.eventually.deep.equal( + realCustomerIds.slice(0, 4).reduce((acc, x) => { + acc.push(x); + acc.push(x); + return acc; + }, []) + )); }); - describe('autoPagingToArray', function() { - it('can go to the end', function() { - return expect(new Promise(function(resolve, reject) { - stripe.customers.list({limit: 3, email: email}) - .autoPagingToArray({limit: TOTAL_OBJECTS + 1}) - .then(function(customers) { - return customers.map(function(customer) { return customer.id; }); - }) - .then(resolve) - .catch(reject); - })).to.eventually.deep.equal(realCustomerIds); - }); - - it('returns a promise of an array', function() { - return expect(new Promise(function(resolve, reject) { - stripe.customers.list({limit: 3, email: email}) - .autoPagingToArray({limit: LIMIT}) - .then(function(customers) { - return customers.map(function(customer) { return customer.id; }); - }) - .then(resolve) - .catch(reject); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('accepts an onDone callback, passing an array', function() { - return expect(new Promise(function(resolve, reject) { - function onDone(err, customers) { - if (err) { - reject(err); - } else { - resolve(customers.map(function(customer) { return customer.id; })); + describe('autoPagingToArray', () => { + it('can go to the end', () => + expect( + new Promise((resolve, reject) => { + stripe.customers + .list({limit: 3, email}) + .autoPagingToArray({limit: TOTAL_OBJECTS + 1}) + .then((customers) => customers.map((customer) => customer.id)) + .then(resolve) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds)); + + it('returns a promise of an array', () => + expect( + new Promise((resolve, reject) => { + stripe.customers + .list({limit: 3, email}) + .autoPagingToArray({limit: LIMIT}) + .then((customers) => customers.map((customer) => customer.id)) + .then(resolve) + .catch(reject); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + + it('accepts an onDone callback, passing an array', () => + expect( + new Promise((resolve, reject) => { + function onDone(err, customers) { + if (err) { + reject(err); + } else { + resolve(customers.map((customer) => customer.id)); + } } - } - stripe.customers.list({limit: 3, email: email}) - .autoPagingToArray({limit: LIMIT}, onDone); - })).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT)); - }); - - it('enforces a `limit` arg', function() { - return expect(new Promise(function(resolve, reject) { - try { - stripe.customers.list({limit: 3, email: email}) - .autoPagingToArray(); - reject(Error('Should have thrown.')); - } catch (err) { - resolve(err.message); - } - })).to.eventually.equal('You must pass a `limit` option to autoPagingToArray, eg; `autoPagingToArray({limit: 1000});`.'); - }); - - it('caps the `limit` arg to a reasonable ceiling', function() { - return expect(new Promise(function(resolve, reject) { - try { - stripe.customers.list({limit: 3, email: email}) - .autoPagingToArray({limit: 1000000}); - reject(Error('Should have thrown.')); - } catch (err) { - resolve(err.message); - } - })).to.eventually.equal('You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.'); - }); + stripe.customers + .list({limit: 3, email}) + .autoPagingToArray({limit: LIMIT}, onDone); + }) + ).to.eventually.deep.equal(realCustomerIds.slice(0, LIMIT))); + + it('enforces a `limit` arg', () => + expect( + new Promise((resolve, reject) => { + try { + stripe.customers.list({limit: 3, email}).autoPagingToArray(); + reject(Error('Should have thrown.')); + } catch (err) { + resolve(err.message); + } + }) + ).to.eventually.equal( + 'You must pass a `limit` option to autoPagingToArray, eg; `autoPagingToArray({limit: 1000});`.' + )); + + it('caps the `limit` arg to a reasonable ceiling', () => + expect( + new Promise((resolve, reject) => { + try { + stripe.customers + .list({limit: 3, email}) + .autoPagingToArray({limit: 1000000}); + reject(Error('Should have thrown.')); + } catch (err) { + resolve(err.message); + } + }) + ).to.eventually.equal( + 'You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.' + )); }); - describe('api compat edge cases', function() { - it('lets you listen to the first request as its own promise, and separately each item, but only sends one request for the first page.', function() { - return expect(new Promise(function(resolve, reject) { - // Count requests: we want one for the first page (not two), and then one for the second page. - var reqCount = 0; - function onRequest() { - reqCount += 1; - } - stripe.on('request', onRequest); - - var customerIds = []; - var p = stripe.customers.list({email: email, limit: 4}) - Promise.all([ - p, - p.autoPagingEach(function(customer) { customerIds.push(customer.id); }), - ]).then(function(results) { - stripe.off('request', onRequest); - expect(reqCount).to.equal(2); // not 3. - - resolve({ - firstReq: results[0].data.map(function(customer) { return customer.id; }), - paginated: customerIds, - }); - }).catch(reject); - })).to.eventually.deep.equal({ + describe('api compat edge cases', () => { + it('lets you listen to the first request as its own promise, and separately each item, but only sends one request for the first page.', () => + expect( + new Promise((resolve, reject) => { + // Count requests: we want one for the first page (not two), and then one for the second page. + let reqCount = 0; + function onRequest() { + reqCount += 1; + } + stripe.on('request', onRequest); + + const customerIds = []; + const p = stripe.customers.list({email, limit: 4}); + Promise.all([ + p, + p.autoPagingEach((customer) => { + customerIds.push(customer.id); + }), + ]) + .then((results) => { + stripe.off('request', onRequest); + expect(reqCount).to.equal(2); // not 3. + + resolve({ + firstReq: results[0].data.map((customer) => customer.id), + paginated: customerIds, + }); + }) + .catch(reject); + }) + ).to.eventually.deep.equal({ firstReq: realCustomerIds.slice(0, 4), paginated: realCustomerIds, - }); - }); + })); }); }); diff --git a/test/flows.spec.js b/test/flows.spec.js index 879918c07a..5df1029065 100644 --- a/test/flows.spec.js +++ b/test/flows.spec.js @@ -1,58 +1,53 @@ 'use strict'; -var testUtils = require('../testUtils'); -var chai = require('chai'); -var stripe = require('../lib/stripe')( - testUtils.getUserStripeKey(), - 'latest' -); -var fs = require('fs'); -var path = require('path'); -var stream = require('stream'); -var expect = chai.expect; - -var CUSTOMER_DETAILS = { +const testUtils = require('../testUtils'); +const chai = require('chai'); +const stripe = require('../lib/stripe')(testUtils.getUserStripeKey(), 'latest'); +const fs = require('fs'); +const path = require('path'); +const stream = require('stream'); +const expect = chai.expect; + +const CUSTOMER_DETAILS = { description: 'Some customer', card: 'tok_visa', }; -var CURRENCY = '_DEFAULT_CURRENCY_NOT_YET_GOTTEN_'; +let CURRENCY = '_DEFAULT_CURRENCY_NOT_YET_GOTTEN_'; describe('Flows', function() { // Note: These tests must be run as one so we can retrieve the // default_currency (required in subsequent tests); - var cleanup = new testUtils.CleanupUtility(); + const cleanup = new testUtils.CleanupUtility(); this.timeout(30000); - it('Allows me to retrieve default_currency', function() { - return expect( - stripe.account.retrieve() - .then(function(acct) { - CURRENCY = acct.default_currency; - return acct; - }) - ).to.eventually.have.property('default_currency'); - }); - - describe('Plan+Subscription flow', function() { - it('Allows me to: Create a plan and subscribe a customer to it', function() { - return expect( + it('Allows me to retrieve default_currency', () => + expect( + stripe.account.retrieve().then((acct) => { + CURRENCY = acct.default_currency; + return acct; + }) + ).to.eventually.have.property('default_currency')); + + describe('Plan+Subscription flow', () => { + it('Allows me to: Create a plan and subscribe a customer to it', () => + expect( Promise.all([ stripe.plans.create({ - id: 'plan' + testUtils.getRandomString(), + id: `plan${testUtils.getRandomString()}`, amount: 1700, currency: CURRENCY, interval: 'month', nickname: 'Gold Super Amazing Tier', product: { - name: 'product' + testUtils.getRandomString(), + name: `product${testUtils.getRandomString()}`, }, }), - stripe.customers.create(CUSTOMER_DETAILS) - ]).then(function(j) { - var plan = j[0]; - var customer = j[1]; + stripe.customers.create(CUSTOMER_DETAILS), + ]).then((j) => { + const plan = j[0]; + const customer = j[1]; cleanup.deleteCustomer(customer.id); cleanup.deletePlan(plan.id); @@ -61,29 +56,27 @@ describe('Flows', function() { plan: plan.id, }); }) - ).to.eventually.have.property('status', 'active'); - }); + ).to.eventually.have.property('status', 'active')); - it( - 'Allows me to: Create a plan and subscribe a customer to it, and update subscription (multi-subs API)', - function() { - var plan; - return expect( - Promise.all([ - stripe.plans.create({ - id: 'plan' + testUtils.getRandomString(), - amount: 1700, - currency: CURRENCY, - interval: 'month', - nickname: 'Gold Super Amazing Tier', - product: { - name: 'product' + testUtils.getRandomString(), - }, - }), - stripe.customers.create(CUSTOMER_DETAILS) - ]).then(function(j) { + it('Allows me to: Create a plan and subscribe a customer to it, and update subscription (multi-subs API)', () => { + let plan; + return expect( + Promise.all([ + stripe.plans.create({ + id: `plan${testUtils.getRandomString()}`, + amount: 1700, + currency: CURRENCY, + interval: 'month', + nickname: 'Gold Super Amazing Tier', + product: { + name: `product${testUtils.getRandomString()}`, + }, + }), + stripe.customers.create(CUSTOMER_DETAILS), + ]) + .then((j) => { plan = j[0]; - var customer = j[1]; + const customer = j[1]; cleanup.deleteCustomer(customer.id); cleanup.deletePlan(plan.id); @@ -91,53 +84,60 @@ describe('Flows', function() { return stripe.customers.createSubscription(customer.id, { plan: plan.id, }); - }).then(function(subscription) { - return stripe.customers.updateSubscription(subscription.customer, subscription.id, { - plan: plan.id, quantity: '3', - }); - }).then(function(subscription) { - return [subscription.status, subscription.quantity]; }) - ).to.eventually.deep.equal(['active', 3]); - } - ); - - it('Errors when I attempt to subscribe a customer to a non-existent plan', function() { - return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(customer) { - cleanup.deleteCustomer(customer.id); - - return stripe.customers.updateSubscription(customer.id, { - plan: 'someNonExistentPlan' + testUtils.getRandomString(), - }).then(null, function(err) { - // Resolve with the error so we can inspect it below - return err; - }); - }) - ).to.eventually.satisfy(function(err) { - return err.type === 'StripeInvalidRequestError' && - err.rawType === 'invalid_request_error'; - }); + .then((subscription) => + stripe.customers.updateSubscription( + subscription.customer, + subscription.id, + { + plan: plan.id, + quantity: '3', + } + ) + ) + .then((subscription) => [subscription.status, subscription.quantity]) + ).to.eventually.deep.equal(['active', 3]); }); - it('Allows me to: subscribe then update with `cancel_at_period_end` defined', function() { - return expect( + it('Errors when I attempt to subscribe a customer to a non-existent plan', () => + expect( + stripe.customers.create(CUSTOMER_DETAILS).then((customer) => { + cleanup.deleteCustomer(customer.id); + + return stripe.customers + .updateSubscription(customer.id, { + plan: `someNonExistentPlan${testUtils.getRandomString()}`, + }) + .then( + null, + (err) => + // Resolve with the error so we can inspect it below + err + ); + }) + ).to.eventually.satisfy( + (err) => + err.type === 'StripeInvalidRequestError' && + err.rawType === 'invalid_request_error' + )); + + it('Allows me to: subscribe then update with `cancel_at_period_end` defined', () => + expect( Promise.all([ stripe.plans.create({ - id: 'plan' + testUtils.getRandomString(), + id: `plan${testUtils.getRandomString()}`, amount: 1700, currency: CURRENCY, interval: 'month', nickname: 'Silver Super Amazing Tier', product: { - name: 'product' + testUtils.getRandomString(), + name: `product${testUtils.getRandomString()}`, }, }), - stripe.customers.create(CUSTOMER_DETAILS) - ]).then(function(j) { - var plan = j[0]; - var customer = j[1]; + stripe.customers.create(CUSTOMER_DETAILS), + ]).then((j) => { + const plan = j[0]; + const customer = j[1]; cleanup.deleteCustomer(customer.id); cleanup.deletePlan(plan.id); @@ -147,287 +147,274 @@ describe('Flows', function() { cancel_at_period_end: true, }); }) - ).to.eventually.have.property('cancel_at_period_end', true); - }); + ).to.eventually.have.property('cancel_at_period_end', true)); - describe('Plan name variations', function() { + describe('Plan name variations', () => { [ - '34535_355453' + testUtils.getRandomString(), - 'TEST_239291' + testUtils.getRandomString(), - 'TEST_a-i' + testUtils.getRandomString(), - 'foobarbazteston___etwothree' + testUtils.getRandomString(), - ].forEach(function(planID) { - it('Allows me to create and retrieve plan with ID: ' + planID, function() { - return expect( - stripe.plans.create({ - id: planID, - amount: 1700, - currency: CURRENCY, - interval: 'month', - nickname: 'generic', - product: { - name: 'product' + testUtils.getRandomString(), - }, - }).then(function() { - cleanup.deletePlan(planID); - return stripe.plans.retrieve(planID); - }) - ).to.eventually.have.property('id', planID); - }); + `34535_355453${testUtils.getRandomString()}`, + `TEST_239291${testUtils.getRandomString()}`, + `TEST_a-i${testUtils.getRandomString()}`, + `foobarbazteston___etwothree${testUtils.getRandomString()}`, + ].forEach((planID) => { + it(`Allows me to create and retrieve plan with ID: ${planID}`, () => + expect( + stripe.plans + .create({ + id: planID, + amount: 1700, + currency: CURRENCY, + interval: 'month', + nickname: 'generic', + product: { + name: `product${testUtils.getRandomString()}`, + }, + }) + .then(() => { + cleanup.deletePlan(planID); + return stripe.plans.retrieve(planID); + }) + ).to.eventually.have.property('id', planID)); }); }); }); - describe('Coupon flow', function() { - var customer; - var coupon; + describe('Coupon flow', () => { + let customer; + let coupon; - describe('When I create a coupon & customer', function() { - it('Does so', function() { - return expect( + describe('When I create a coupon & customer', () => { + it('Does so', () => + expect( Promise.all([ stripe.coupons.create({ percent_off: 20, duration: 'once', }), - stripe.customers.create(CUSTOMER_DETAILS) - ]).then(function(joined) { + stripe.customers.create(CUSTOMER_DETAILS), + ]).then((joined) => { coupon = joined[0]; customer = joined[1]; }) - ).to.not.be.eventually.rejected; - }); - describe('And I apply the coupon to the customer', function() { - it('Does so', function() { - return expect( + ).to.not.be.eventually.rejected); + describe('And I apply the coupon to the customer', () => { + it('Does so', () => + expect( stripe.customers.update(customer.id, { coupon: coupon.id, }) - ).to.not.be.eventually.rejected; - }); - it('Can be retrieved from that customer', function() { - return expect( + ).to.not.be.eventually.rejected); + it('Can be retrieved from that customer', () => + expect( stripe.customers.retrieve(customer.id) - ).to.eventually.have.nested.property('discount.coupon.id', coupon.id); - }); - describe('The resulting discount', function() { - it('Can be removed', function() { - return expect( + ).to.eventually.have.nested.property( + 'discount.coupon.id', + coupon.id + )); + describe('The resulting discount', () => { + it('Can be removed', () => + expect( stripe.customers.deleteDiscount(customer.id) - ).to.eventually.have.property('deleted', true); - }); - describe('Re-querying it', function() { - it('Does indeed indicate that it is deleted', function() { - return expect( + ).to.eventually.have.property('deleted', true)); + describe('Re-querying it', () => { + it('Does indeed indicate that it is deleted', () => + expect( stripe.customers.retrieve(customer.id) - ).to.eventually.have.property('discount', null); - }); + ).to.eventually.have.property('discount', null)); }); }); }); }); }); - describe('Metadata flow', function() { - it('Can save and retrieve metadata', function() { - var customer; + describe('Metadata flow', () => { + it('Can save and retrieve metadata', () => { + let customer; return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(cust) { + stripe.customers + .create(CUSTOMER_DETAILS) + .then((cust) => { customer = cust; cleanup.deleteCustomer(cust.id); return stripe.customers.setMetadata(cust.id, {foo: '123'}); }) - .then(function() { - return stripe.customers.getMetadata(customer.id); - }) + .then(() => stripe.customers.getMetadata(customer.id)) ).to.eventually.deep.equal({foo: '123'}); }); - it('Can reset metadata', function() { - var customer; + it('Can reset metadata', () => { + let customer; return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(cust) { + stripe.customers + .create(CUSTOMER_DETAILS) + .then((cust) => { customer = cust; cleanup.deleteCustomer(cust.id); return stripe.customers.setMetadata(cust.id, {baz: '123'}); }) - .then(function() { - return stripe.customers.setMetadata(customer.id, null); - }) - .then(function() { - return stripe.customers.getMetadata(customer.id); - }) + .then(() => stripe.customers.setMetadata(customer.id, null)) + .then(() => stripe.customers.getMetadata(customer.id)) ).to.eventually.deep.equal({}); }); - it('Resets metadata when setting new metadata', function() { - var customer; + it('Resets metadata when setting new metadata', () => { + let customer; return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(cust) { + stripe.customers + .create(CUSTOMER_DETAILS) + .then((cust) => { customer = cust; cleanup.deleteCustomer(cust.id); return stripe.customers.setMetadata(cust.id, {foo: '123'}); }) - .then(function() { - return stripe.customers.setMetadata(customer.id, {baz: '456'}); - }) + .then(() => stripe.customers.setMetadata(customer.id, {baz: '456'})) ).to.eventually.deep.equal({baz: '456'}); }); - it('Can set individual key/value pairs', function() { - var customer; + it('Can set individual key/value pairs', () => { + let customer; return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(cust) { + stripe.customers + .create(CUSTOMER_DETAILS) + .then((cust) => { customer = cust; cleanup.deleteCustomer(cust.id); }) - .then(function() { - return stripe.customers.setMetadata(customer.id, 'baz', 456); - }) - .then(function() { - return stripe.customers.setMetadata(customer.id, '_other_', 999); - }) - .then(function() { - return stripe.customers.setMetadata(customer.id, 'foo', 123); - }) - .then(function() { + .then(() => stripe.customers.setMetadata(customer.id, 'baz', 456)) + .then(() => stripe.customers.setMetadata(customer.id, '_other_', 999)) + .then(() => stripe.customers.setMetadata(customer.id, 'foo', 123)) + .then(() => // Change foo - return stripe.customers.setMetadata(customer.id, 'foo', 222); - }) - .then(function() { + stripe.customers.setMetadata(customer.id, 'foo', 222) + ) + .then(() => // Delete baz - return stripe.customers.setMetadata(customer.id, 'baz', null); - }) - .then(function() { - return stripe.customers.getMetadata(customer.id); - }) + stripe.customers.setMetadata(customer.id, 'baz', null) + ) + .then(() => stripe.customers.getMetadata(customer.id)) ).to.eventually.deep.equal({_other_: '999', foo: '222'}); }); - it('Can set individual key/value pairs [with per request token]', function() { - var customer; - var authToken = testUtils.getUserStripeKey(); + it('Can set individual key/value pairs [with per request token]', () => { + let customer; + const authToken = testUtils.getUserStripeKey(); return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(cust) { + stripe.customers + .create(CUSTOMER_DETAILS) + .then((cust) => { customer = cust; cleanup.deleteCustomer(cust.id); }) - .then(function() { - return stripe.customers.setMetadata(customer.id, {'baz': 456}, authToken); - }) - .then(function() { - return stripe.customers.setMetadata(customer.id, '_other_', 999, authToken); - }) - .then(function() { - return stripe.customers.setMetadata(customer.id, 'foo', 123, authToken); - }) - .then(function() { + .then(() => + stripe.customers.setMetadata(customer.id, {baz: 456}, authToken) + ) + .then(() => + stripe.customers.setMetadata(customer.id, '_other_', 999, authToken) + ) + .then(() => + stripe.customers.setMetadata(customer.id, 'foo', 123, authToken) + ) + .then(() => // Change foo - return stripe.customers.setMetadata(customer.id, 'foo', 222, authToken); - }) - .then(function() { + stripe.customers.setMetadata(customer.id, 'foo', 222, authToken) + ) + .then(() => // Delete baz - return stripe.customers.setMetadata(customer.id, 'baz', null, authToken); - }) - .then(function() { - return stripe.customers.getMetadata(customer.id, authToken); - }) + stripe.customers.setMetadata(customer.id, 'baz', null, authToken) + ) + .then(() => stripe.customers.getMetadata(customer.id, authToken)) ).to.eventually.deep.equal({_other_: '999', foo: '222'}); }); }); - describe('Expanding', function() { - describe('A customer within a charge', function() { - it('Allows you to expand a customer object', function() { - return expect( - stripe.customers.create(CUSTOMER_DETAILS) - .then(function(cust) { - cleanup.deleteCustomer(cust.id); - return stripe.charges.create({ - customer: cust.id, - amount: 1700, - currency: CURRENCY, - expand: ['customer'], - }); - }) - ).to.eventually.have.nested.property('customer.created'); - }); - }); - describe('A customer\'s default source', function() { - it('Allows you to expand a default_source', function() { - return expect( - stripe.customers.create({ - description: 'Some customer', - source: 'tok_visa', - expand: ['default_source'], + describe('Expanding', () => { + describe('A customer within a charge', () => { + it('Allows you to expand a customer object', () => + expect( + stripe.customers.create(CUSTOMER_DETAILS).then((cust) => { + cleanup.deleteCustomer(cust.id); + return stripe.charges.create({ + customer: cust.id, + amount: 1700, + currency: CURRENCY, + expand: ['customer'], + }); }) - .then(function(cust) { + ).to.eventually.have.nested.property('customer.created')); + }); + describe("A customer's default source", () => { + it('Allows you to expand a default_source', () => + expect( + stripe.customers + .create({ + description: 'Some customer', + source: 'tok_visa', + expand: ['default_source'], + }) + .then((cust) => { cleanup.deleteCustomer(cust.id); return cust; }) // Confirm it's expanded by checking that some prop (e.g. exp_year) exists: - ).to.eventually.have.nested.property('default_source.exp_year'); - }); + ).to.eventually.have.nested.property('default_source.exp_year')); }); }); - describe('Charge', function() { - it('Allows you to create a charge', function() { - return expect( - stripe.charges.create({ - amount: 1234, - currency: CURRENCY, - card: 'tok_chargeDeclined', - shipping: { - name: 'Bobby Tables', - address: { - line1: '1 Foo St.', + describe('Charge', () => { + it('Allows you to create a charge', () => + expect( + stripe.charges + .create({ + amount: 1234, + currency: CURRENCY, + card: 'tok_chargeDeclined', + shipping: { + name: 'Bobby Tables', + address: { + line1: '1 Foo St.', + }, }, - }, - }).then(null, function(error) { - return error; - }) - ).to.eventually.have.nested.property('raw.charge'); - }); + }) + .then(null, (error) => error) + ).to.eventually.have.nested.property('raw.charge')); }); - describe('Getting balance', function() { - it('Allows me to do so', function() { - return expect( - stripe.balance.retrieve() - ).to.eventually.have.property('object', 'balance'); - }); - it('Allows me to do so with specified auth key', function() { - return expect( + describe('Getting balance', () => { + it('Allows me to do so', () => + expect(stripe.balance.retrieve()).to.eventually.have.property( + 'object', + 'balance' + )); + it('Allows me to do so with specified auth key', () => + expect( stripe.balance.retrieve(testUtils.getUserStripeKey()) - ).to.eventually.have.property('object', 'balance'); - }); + ).to.eventually.have.property('object', 'balance')); }); - describe('Request/Response Events', function() { - var connectedAccountId; + describe('Request/Response Events', () => { + let connectedAccountId; - before(function(done) { + before((done) => { // Pick a random connected account to use in the `Stripe-Account` header - stripe.accounts.list({ - limit: 1, - }).then(function(accounts) { - if (accounts.data.length < 1) { - return done( - new Error('Test requires at least one Connected Account in the Test Account') - ); - } - - connectedAccountId = accounts.data[0].id; - - done(); - }); + stripe.accounts + .list({ + limit: 1, + }) + .then((accounts) => { + if (accounts.data.length < 1) { + return done( + new Error( + 'Test requires at least one Connected Account in the Test Account' + ) + ); + } + + connectedAccountId = accounts.data[0].id; + + done(); + }); }); - it('should emit a `request` event to listeners on request', function(done) { - var apiVersion = '2017-06-05'; - var idempotencyKey = Math.random().toString(36).slice(2); + it('should emit a `request` event to listeners on request', (done) => { + const apiVersion = '2017-06-05'; + const idempotencyKey = Math.random() + .toString(36) + .slice(2); function onRequest(request) { stripe.off('request', onRequest); @@ -445,22 +432,29 @@ describe('Flows', function() { stripe.on('request', onRequest); - stripe.charges.create({ - amount: 1234, - currency: 'usd', - card: 'tok_chargeDeclined', - }, { - stripe_version: apiVersion, - idempotency_key: idempotencyKey, - stripe_account: connectedAccountId, - }).then(null, function() { - // I expect there to be an error here. - }); + stripe.charges + .create( + { + amount: 1234, + currency: 'usd', + card: 'tok_chargeDeclined', + }, + { + stripe_version: apiVersion, + idempotency_key: idempotencyKey, + stripe_account: connectedAccountId, + } + ) + .then(null, () => { + // I expect there to be an error here. + }); }); - it('should emit a `response` event to listeners on response', function(done) { - var apiVersion = '2017-06-05'; - var idempotencyKey = Math.random().toString(36).slice(2); + it('should emit a `response` event to listeners on response', (done) => { + const apiVersion = '2017-06-05'; + const idempotencyKey = Math.random() + .toString(36) + .slice(2); function onResponse(response) { // On the off chance we're picking up a response from a differentrequest @@ -485,20 +479,25 @@ describe('Flows', function() { stripe.on('response', onResponse); - stripe.charges.create({ - amount: 1234, - currency: 'usd', - card: 'tok_chargeDeclined', - }, { - stripe_version: apiVersion, - idempotency_key: idempotencyKey, - stripe_account: connectedAccountId, - }).then(null, function() { - // I expect there to be an error here. - }); + stripe.charges + .create( + { + amount: 1234, + currency: 'usd', + card: 'tok_chargeDeclined', + }, + { + stripe_version: apiVersion, + idempotency_key: idempotencyKey, + stripe_account: connectedAccountId, + } + ) + .then(null, () => { + // I expect there to be an error here. + }); }); - it('should not emit a `response` event to removed listeners on response', function(done) { + it('should not emit a `response` event to removed listeners on response', (done) => { function onResponse(response) { done(new Error('How did you get here?')); } @@ -506,76 +505,82 @@ describe('Flows', function() { stripe.on('response', onResponse); stripe.off('response', onResponse); - stripe.charges.create({ - amount: 1234, - currency: 'usd', - card: 'tok_visa', - }).then(function() { - done(); - }); + stripe.charges + .create({ + amount: 1234, + currency: 'usd', + card: 'tok_visa', + }) + .then(() => { + done(); + }); }); }); - describe('FileUpload', function() { - it('Allows you to upload a file as a stream', function() { - var testFilename = path.join(__dirname, 'resources/data/minimal.pdf'); - var f = fs.createReadStream(testFilename); + describe('FileUpload', () => { + it('Allows you to upload a file as a stream', () => { + const testFilename = path.join(__dirname, 'resources/data/minimal.pdf'); + const f = fs.createReadStream(testFilename); return expect( - stripe.fileUploads.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - }).then(null, function(error) { - return error; - }) + stripe.fileUploads + .create({ + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + }) + .then(null, (error) => error) ).to.eventually.have.nested.property('size', 739); }); - it('Allows you to upload a file synchronously', function() { - var testFilename = path.join(__dirname, 'resources/data/minimal.pdf'); - var f = fs.readFileSync(testFilename); + it('Allows you to upload a file synchronously', () => { + const testFilename = path.join(__dirname, 'resources/data/minimal.pdf'); + const f = fs.readFileSync(testFilename); return expect( - stripe.fileUploads.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - }).then(null, function(error) { - return error; - }) + stripe.fileUploads + .create({ + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + }) + .then(null, (error) => error) ).to.eventually.have.nested.property('size', 739); }); - it('Surfaces stream errors correctly', function(done) { - var mockedStream = new stream.Readable(); - mockedStream._read = function() {}; + it('Surfaces stream errors correctly', (done) => { + const mockedStream = new stream.Readable(); + mockedStream._read = () => {}; - var fakeError = new Error('I am a fake error'); + const fakeError = new Error('I am a fake error'); - process.nextTick(function() { + process.nextTick(() => { mockedStream.emit('error', fakeError); }); - stripe.fileUploads.create({ - purpose: 'dispute_evidence', - file: { - data: mockedStream, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - }).catch(function(error) { - expect(error.message).to.equal('An error occurred while attempting to process the file for upload.'); - expect(error.detail).to.equal(fakeError); + stripe.fileUploads + .create({ + purpose: 'dispute_evidence', + file: { + data: mockedStream, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + }) + .catch((error) => { + expect(error.message).to.equal( + 'An error occurred while attempting to process the file for upload.' + ); + expect(error.detail).to.equal(fakeError); - done(); - }); + done(); + }); }); }); }); diff --git a/test/resources/Account.spec.js b/test/resources/Account.spec.js index 378aa433b3..e09d6f2c06 100644 --- a/test/resources/Account.spec.js +++ b/test/resources/Account.spec.js @@ -1,17 +1,17 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; +const TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; -describe('Account Resource', function() { +describe('Account Resource', () => { function uniqueEmail() { - return Math.random() + 'bob@example.com'; + return `${Math.random()}bob@example.com`; } - describe('create', function() { - it('Sends the correct request', function() { - var data = { + describe('create', () => { + it('Sends the correct request', () => { + const data = { managed: false, country: 'US', email: uniqueEmail(), @@ -20,14 +20,14 @@ describe('Account Resource', function() { expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/accounts', - data: data, + data, headers: {}, }); }); }); - describe('delete', function() { - it('deletes an account successfully', function() { + describe('delete', () => { + it('deletes an account successfully', () => { stripe.account.del('acct_16Tzq6DBahdM4C8s'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -38,8 +38,8 @@ describe('Account Resource', function() { }); }); - describe('reject', function() { - it('rejects an account successfully', function() { + describe('reject', () => { + it('rejects an account successfully', () => { stripe.account.reject('acct_16Tzq6DBahdM4C8s', {reason: 'fraud'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -50,8 +50,8 @@ describe('Account Resource', function() { }); }); - describe('retrieve', function() { - it('Sends the correct request with no params', function() { + describe('retrieve', () => { + it('Sends the correct request with no params', () => { stripe.account.retrieve(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -61,7 +61,7 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request with ID param', function() { + it('Sends the correct request with ID param', () => { stripe.account.retrieve('foo'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -71,8 +71,8 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request with secret key', function() { - var key = 'sk_12345678901234567890123456789012'; + it('Sends the correct request with secret key', () => { + const key = 'sk_12345678901234567890123456789012'; stripe.account.retrieve(null, key); expect(stripe.LAST_REQUEST).to.deep.equal({ auth: key, @@ -83,8 +83,8 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request with secret key as first object', function() { - var params = {api_key: 'sk_12345678901234567890123456789012'}; + it('Sends the correct request with secret key as first object', () => { + const params = {api_key: 'sk_12345678901234567890123456789012'}; stripe.account.retrieve(params); expect(stripe.LAST_REQUEST).to.deep.equal({ auth: params.api_key, @@ -95,8 +95,8 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request with a callback', function() { - stripe.account.retrieve(function(err, account) {}); + it('Sends the correct request with a callback', () => { + stripe.account.retrieve((err, account) => {}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/account', @@ -106,23 +106,32 @@ describe('Account Resource', function() { }); }); - describe('External account methods', function() { - describe('retrieveExternalAccount', function() { - it('Sends the correct request', function() { - stripe.account.retrieveExternalAccount('accountIdFoo321', 'externalAccountIdFoo456'); + describe('External account methods', () => { + describe('retrieveExternalAccount', () => { + it('Sends the correct request', () => { + stripe.account.retrieveExternalAccount( + 'accountIdFoo321', + 'externalAccountIdFoo456' + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', + url: + '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', headers: {}, data: {}, }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.account.retrieveExternalAccount('accountIdFoo321', 'externalAccountIdFoo456', TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.account.retrieveExternalAccount( + 'accountIdFoo321', + 'externalAccountIdFoo456', + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', + url: + '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', headers: {}, data: {}, auth: TEST_AUTH_KEY, @@ -130,10 +139,12 @@ describe('Account Resource', function() { }); }); - describe('createExternalAccount', function() { - it('Sends the correct request', function() { + describe('createExternalAccount', () => { + it('Sends the correct request', () => { stripe.account.createExternalAccount('accountIdFoo321', { - number: '123456', currency: 'usd', country: 'US', + number: '123456', + currency: 'usd', + country: 'US', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -143,10 +154,16 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.account.createExternalAccount('accountIdFoo321', { - number: '123456', currency: 'usd', country: 'US', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.account.createExternalAccount( + 'accountIdFoo321', + { + number: '123456', + currency: 'usd', + country: 'US', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/accounts/accountIdFoo321/external_accounts', @@ -157,36 +174,50 @@ describe('Account Resource', function() { }); }); - describe('updateExternalAccount', function() { - it('Sends the correct request', function() { - stripe.account.updateExternalAccount('accountIdFoo321', 'externalAccountIdFoo456', { - default_for_currency: true, - }); + describe('updateExternalAccount', () => { + it('Sends the correct request', () => { + stripe.account.updateExternalAccount( + 'accountIdFoo321', + 'externalAccountIdFoo456', + { + default_for_currency: true, + } + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', + url: + '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', headers: {}, data: {default_for_currency: true}, }); }); }); - describe('deleteExternalAccount', function() { - it('Sends the correct request', function() { - stripe.account.deleteExternalAccount('accountIdFoo321', 'externalAccountIdFoo456'); + describe('deleteExternalAccount', () => { + it('Sends the correct request', () => { + stripe.account.deleteExternalAccount( + 'accountIdFoo321', + 'externalAccountIdFoo456' + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', + url: + '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', headers: {}, data: {}, }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.account.deleteExternalAccount('accountIdFoo321', 'externalAccountIdFoo456', TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.account.deleteExternalAccount( + 'accountIdFoo321', + 'externalAccountIdFoo456', + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', + url: + '/v1/accounts/accountIdFoo321/external_accounts/externalAccountIdFoo456', headers: {}, data: {}, auth: TEST_AUTH_KEY, @@ -194,8 +225,8 @@ describe('Account Resource', function() { }); }); - describe('listExternalAccounts', function() { - it('Sends the correct request', function() { + describe('listExternalAccounts', () => { + it('Sends the correct request', () => { stripe.account.listExternalAccounts('accountIdFoo321'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -205,7 +236,7 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.account.listExternalAccounts('accountIdFoo321', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -218,9 +249,9 @@ describe('Account Resource', function() { }); }); - describe('LoginLink methods', function() { - describe('createLoginLink', function() { - it('Sends the correct request', function() { + describe('LoginLink methods', () => { + describe('createLoginLink', () => { + it('Sends the correct request', () => { stripe.account.createLoginLink('acct_EXPRESS'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -232,9 +263,9 @@ describe('Account Resource', function() { }); }); - describe('Person methods', function() { - describe('retrievePerson', function() { - it('Sends the correct request', function() { + describe('Person methods', () => { + describe('retrievePerson', () => { + it('Sends the correct request', () => { stripe.account.retrievePerson('acct_123', 'person_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -244,7 +275,7 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.account.retrievePerson('acct_123', 'person_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -256,8 +287,8 @@ describe('Account Resource', function() { }); }); - describe('createPerson', function() { - it('Sends the correct request', function() { + describe('createPerson', () => { + it('Sends the correct request', () => { stripe.account.createPerson('acct_123', { first_name: 'John', }); @@ -269,10 +300,14 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.account.createPerson('acct_123', { - first_name: 'John', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.account.createPerson( + 'acct_123', + { + first_name: 'John', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/accounts/acct_123/persons', @@ -283,8 +318,8 @@ describe('Account Resource', function() { }); }); - describe('updatePerson', function() { - it('Sends the correct request', function() { + describe('updatePerson', () => { + it('Sends the correct request', () => { stripe.account.updatePerson('acct_123', 'person_123', { first_name: 'John', }); @@ -296,10 +331,15 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.account.updatePerson('acct_123', 'person_123', { - first_name: 'John', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.account.updatePerson( + 'acct_123', + 'person_123', + { + first_name: 'John', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/accounts/acct_123/persons/person_123', @@ -310,8 +350,8 @@ describe('Account Resource', function() { }); }); - describe('deletePerson', function() { - it('Sends the correct request', function() { + describe('deletePerson', () => { + it('Sends the correct request', () => { stripe.account.deletePerson('acct_123', 'person_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -321,7 +361,7 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.account.deletePerson('acct_123', 'person_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -333,8 +373,8 @@ describe('Account Resource', function() { }); }); - describe('listPersons', function() { - it('Sends the correct request', function() { + describe('listPersons', () => { + it('Sends the correct request', () => { stripe.account.listPersons('acct_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -344,7 +384,7 @@ describe('Account Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.account.listPersons('acct_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/AccountLinks.spec.js b/test/resources/AccountLinks.spec.js index 74dfe1caef..bd42414fcd 100644 --- a/test/resources/AccountLinks.spec.js +++ b/test/resources/AccountLinks.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('AccountLinks Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('AccountLinks Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { stripe.accountLinks.create({ account: 'acct_123', failure_url: 'https://stripe.com/failure', diff --git a/test/resources/ApplePayDomains.spec.js b/test/resources/ApplePayDomains.spec.js index 106e3fd9fd..38fd741849 100644 --- a/test/resources/ApplePayDomains.spec.js +++ b/test/resources/ApplePayDomains.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('ApplePayDomains Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('ApplePayDomains Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.applePayDomains.retrieve('apwc_retrieve'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('ApplePayDomains Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.applePayDomains.del('apwc_delete'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -28,8 +28,8 @@ describe('ApplePayDomains Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.applePayDomains.create({ domain_name: 'example.com', }); @@ -45,8 +45,8 @@ describe('ApplePayDomains Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.applePayDomains.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/ApplicationFeeRefunds.spec.js b/test/resources/ApplicationFeeRefunds.spec.js index f4f2a72a80..75be78aa2e 100644 --- a/test/resources/ApplicationFeeRefunds.spec.js +++ b/test/resources/ApplicationFeeRefunds.spec.js @@ -1,54 +1,53 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var APPFEE_TEST_ID = 'appFeeIdTest999'; -var REFUND_TEST_ID = 'refundIdTest999'; +const APPFEE_TEST_ID = 'appFeeIdTest999'; +const REFUND_TEST_ID = 'refundIdTest999'; // Create new CustomerCard instance with pre-filled customerId: -var appFeeRefund = new resources.ApplicationFeeRefunds( - stripe, - {feeId: APPFEE_TEST_ID} -); +const appFeeRefund = new resources.ApplicationFeeRefunds(stripe, { + feeId: APPFEE_TEST_ID, +}); // Use spy from existing resource: appFeeRefund._request = stripe.customers._request; -describe('ApplicationFeeRefund Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('ApplicationFeeRefund Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { appFeeRefund.retrieve(REFUND_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/application_fees/' + APPFEE_TEST_ID + '/refunds/' + REFUND_TEST_ID, + url: `/v1/application_fees/${APPFEE_TEST_ID}/refunds/${REFUND_TEST_ID}`, data: {}, headers: {}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { appFeeRefund.update(REFUND_TEST_ID, { metadata: {key: 'value'}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/application_fees/' + APPFEE_TEST_ID + '/refunds/' + REFUND_TEST_ID, + url: `/v1/application_fees/${APPFEE_TEST_ID}/refunds/${REFUND_TEST_ID}`, data: {metadata: {key: 'value'}}, headers: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { appFeeRefund.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/application_fees/' + APPFEE_TEST_ID + '/refunds', + url: `/v1/application_fees/${APPFEE_TEST_ID}/refunds`, data: {}, headers: {}, }); diff --git a/test/resources/ApplicationFees.spec.js b/test/resources/ApplicationFees.spec.js index 2cec4f95ff..74487d76df 100644 --- a/test/resources/ApplicationFees.spec.js +++ b/test/resources/ApplicationFees.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('ApplicationFee Resource', function() { - describe('list', function() { - it('Sends the correct request', function() { +describe('ApplicationFee Resource', () => { + describe('list', () => { + it('Sends the correct request', () => { stripe.applicationFees.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,9 +16,11 @@ describe('ApplicationFee Resource', function() { }); }); - describe('refund', function() { - it('Sends the correct request', function() { - stripe.applicationFees.refund('applicationFeeIdExample3242', {amount: 23}); + describe('refund', () => { + it('Sends the correct request', () => { + stripe.applicationFees.refund('applicationFeeIdExample3242', { + amount: 23, + }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/application_fees/applicationFeeIdExample3242/refund', @@ -28,8 +30,8 @@ describe('ApplicationFee Resource', function() { }); }); - describe('refunds', function() { - it('Sends the correct update request', function() { + describe('refunds', () => { + it('Sends the correct update request', () => { stripe.applicationFees.updateRefund( 'appFeeIdExample3242', 'refundIdExample2312', @@ -37,17 +39,15 @@ describe('ApplicationFee Resource', function() { ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/application_fees/appFeeIdExample3242/refunds/refundIdExample2312', + url: + '/v1/application_fees/appFeeIdExample3242/refunds/refundIdExample2312', data: {metadata: {key: 'value'}}, headers: {}, }); }); - it('Sends the correct create request', function() { - stripe.applicationFees.createRefund( - 'appFeeIdExample3242', - {amount: 100} - ); + it('Sends the correct create request', () => { + stripe.applicationFees.createRefund('appFeeIdExample3242', {amount: 100}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/application_fees/appFeeIdExample3242/refunds', @@ -56,10 +56,8 @@ describe('ApplicationFee Resource', function() { }); }); - it('Sends the correct list request', function() { - stripe.applicationFees.listRefunds( - 'appFeeIdExample3242' - ); + it('Sends the correct list request', () => { + stripe.applicationFees.listRefunds('appFeeIdExample3242'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/application_fees/appFeeIdExample3242/refunds', @@ -68,14 +66,15 @@ describe('ApplicationFee Resource', function() { }); }); - it('Sends the correct retrieve request', function() { + it('Sends the correct retrieve request', () => { stripe.applicationFees.retrieveRefund( 'appFeeIdExample3242', 'refundIdExample2312' ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/application_fees/appFeeIdExample3242/refunds/refundIdExample2312', + url: + '/v1/application_fees/appFeeIdExample3242/refunds/refundIdExample2312', data: {}, headers: {}, }); diff --git a/test/resources/Balance.spec.js b/test/resources/Balance.spec.js index 0845e36106..c1e8a3f686 100644 --- a/test/resources/Balance.spec.js +++ b/test/resources/Balance.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Balance Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Balance Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.balance.retrieve(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -15,7 +15,7 @@ describe('Balance Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.balance.retrieve('aGN0bIwXnHdw5645VABjPdSn8nWY7G11'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -27,8 +27,8 @@ describe('Balance Resource', function() { }); }); - describe('listTransactions', function() { - it('Sends the correct request', function() { + describe('listTransactions', () => { + it('Sends the correct request', () => { stripe.balance.listTransactions(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -38,7 +38,7 @@ describe('Balance Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.balance.listTransactions('aGN0bIwXnHdw5645VABjPdSn8nWY7G11'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -50,8 +50,8 @@ describe('Balance Resource', function() { }); }); - describe('retrieveTransaction', function() { - it('Sends the correct request', function() { + describe('retrieveTransaction', () => { + it('Sends the correct request', () => { stripe.balance.retrieveTransaction('transactionIdFoo'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -61,8 +61,11 @@ describe('Balance Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.balance.retrieveTransaction('transactionIdFoo', 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'); + it('Sends the correct request [with specified auth]', () => { + stripe.balance.retrieveTransaction( + 'transactionIdFoo', + 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11' + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/balance/history/transactionIdFoo', diff --git a/test/resources/BitcoinReceivers.spec.js b/test/resources/BitcoinReceivers.spec.js index 2ca675e6bc..494840c17a 100644 --- a/test/resources/BitcoinReceivers.spec.js +++ b/test/resources/BitcoinReceivers.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('BitcoinReceivers Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('BitcoinReceivers Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.bitcoinReceivers.retrieve('receiverId1'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('BitcoinReceivers Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.bitcoinReceivers.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -28,8 +28,8 @@ describe('BitcoinReceivers Resource', function() { }); }); - describe('listTransactions', function() { - it('Sends the correct request', function() { + describe('listTransactions', () => { + it('Sends the correct request', () => { stripe.bitcoinReceivers.listTransactions('receiverId', { limit: 1, }); @@ -40,7 +40,7 @@ describe('BitcoinReceivers Resource', function() { data: { limit: 1, }, - }) + }); }); }); }); diff --git a/test/resources/ChargeRefunds.spec.js b/test/resources/ChargeRefunds.spec.js index adc1790f49..4bba3c1cae 100644 --- a/test/resources/ChargeRefunds.spec.js +++ b/test/resources/ChargeRefunds.spec.js @@ -1,68 +1,67 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var CHARGE_TEST_ID = 'chargeIdTest999'; -var REFUND_TEST_ID = 'refundIdTest999'; +const CHARGE_TEST_ID = 'chargeIdTest999'; +const REFUND_TEST_ID = 'refundIdTest999'; // Create new CustomerCard instance with pre-filled customerId: -var chargeRefund = new resources.ChargeRefunds( - stripe, - {chargeId: CHARGE_TEST_ID} -); +const chargeRefund = new resources.ChargeRefunds(stripe, { + chargeId: CHARGE_TEST_ID, +}); // Use spy from existing resource: chargeRefund._request = stripe.customers._request; -describe('ChargeRefund Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('ChargeRefund Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { chargeRefund.retrieve(REFUND_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/charges/' + CHARGE_TEST_ID + '/refunds/' + REFUND_TEST_ID, + url: `/v1/charges/${CHARGE_TEST_ID}/refunds/${REFUND_TEST_ID}`, data: {}, headers: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { chargeRefund.create({ amount: 100, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/charges/' + CHARGE_TEST_ID + '/refunds', + url: `/v1/charges/${CHARGE_TEST_ID}/refunds`, data: {amount: 100}, headers: {}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { chargeRefund.update(REFUND_TEST_ID, { metadata: {key: 'value'}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/charges/' + CHARGE_TEST_ID + '/refunds/' + REFUND_TEST_ID, + url: `/v1/charges/${CHARGE_TEST_ID}/refunds/${REFUND_TEST_ID}`, data: {metadata: {key: 'value'}}, headers: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { chargeRefund.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/charges/' + CHARGE_TEST_ID + '/refunds', + url: `/v1/charges/${CHARGE_TEST_ID}/refunds`, data: {}, headers: {}, }); diff --git a/test/resources/Charges.spec.js b/test/resources/Charges.spec.js index 6308e82cd0..f0c82a4362 100644 --- a/test/resources/Charges.spec.js +++ b/test/resources/Charges.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Charge Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Charge Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.charges.retrieve('chargeIdFoo123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Charge Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.charges.create({ amount: '1500', currency: 'usd', @@ -44,8 +44,8 @@ describe('Charge Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.charges.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -56,8 +56,8 @@ describe('Charge Resource', function() { }); }); - describe('capture', function() { - it('Sends the correct request', function() { + describe('capture', () => { + it('Sends the correct request', () => { stripe.charges.capture('chargeIdExample3242', {amount: 23}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -68,8 +68,8 @@ describe('Charge Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.charges.update('chargeIdExample3242', {description: 'foo321'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -80,8 +80,8 @@ describe('Charge Resource', function() { }); }); - describe('refund', function() { - it('Sends the correct request', function() { + describe('refund', () => { + it('Sends the correct request', () => { stripe.charges.refund('chargeIdExample3242', {amount: 23}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -91,7 +91,7 @@ describe('Charge Resource', function() { }); }); - it('Incorrect arguments result in an error', function() { + it('Incorrect arguments result in an error', () => { expect( stripe.charges.refund('chargeIdExample123', 39392) ).to.be.eventually.rejectedWith(/unknown arguments/i); @@ -100,14 +100,14 @@ describe('Charge Resource', function() { stripe.charges.refund({potato: 'chargeIdExample123'}) ).to.be.eventually.rejectedWith(/must be a string, but got: object/i); - expect( - stripe.charges.refund(442) - ).to.be.eventually.rejectedWith(/must be a string, but got: number/i); + expect(stripe.charges.refund(442)).to.be.eventually.rejectedWith( + /must be a string, but got: number/i + ); }); }); - describe('refunds', function() { - it('Sends the correct update request', function() { + describe('refunds', () => { + it('Sends the correct update request', () => { stripe.charges.updateRefund( 'chargeIdExample3242', 'refundIdExample2312', @@ -121,11 +121,8 @@ describe('Charge Resource', function() { }); }); - it('Sends the correct create request', function() { - stripe.charges.createRefund( - 'chargeIdExample3242', - {amount: 100} - ); + it('Sends the correct create request', () => { + stripe.charges.createRefund('chargeIdExample3242', {amount: 100}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/charges/chargeIdExample3242/refunds', @@ -134,10 +131,8 @@ describe('Charge Resource', function() { }); }); - it('Sends the correct list request', function() { - stripe.charges.listRefunds( - 'chargeIdExample3242' - ); + it('Sends the correct list request', () => { + stripe.charges.listRefunds('chargeIdExample3242'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/charges/chargeIdExample3242/refunds', @@ -146,7 +141,7 @@ describe('Charge Resource', function() { }); }); - it('Sends the correct retrieve request', function() { + it('Sends the correct retrieve request', () => { stripe.charges.retrieveRefund( 'chargeIdExample3242', 'refundIdExample2312' @@ -160,8 +155,8 @@ describe('Charge Resource', function() { }); }); - describe('updateDispute', function() { - it('Sends the correct request', function() { + describe('updateDispute', () => { + it('Sends the correct request', () => { stripe.charges.updateDispute('chargeIdExample3242', {evidence: 'foo'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -172,8 +167,8 @@ describe('Charge Resource', function() { }); }); - describe('closeDispute', function() { - it('Sends the correct request', function() { + describe('closeDispute', () => { + it('Sends the correct request', () => { stripe.charges.closeDispute('chargeIdExample3242', {}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -184,25 +179,25 @@ describe('Charge Resource', function() { }); }); - describe('markAsFraudulent', function() { - it('Sends the correct request', function() { + describe('markAsFraudulent', () => { + it('Sends the correct request', () => { stripe.charges.markAsFraudulent('chargeIdExample3242'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/charges/chargeIdExample3242', - data: {'fraud_details': {'user_report': 'fraudulent'}}, + data: {fraud_details: {user_report: 'fraudulent'}}, headers: {}, }); }); }); - describe('markAsSafe', function() { - it('Sends the correct request', function() { + describe('markAsSafe', () => { + it('Sends the correct request', () => { stripe.charges.markAsSafe('chargeIdExample3242'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/charges/chargeIdExample3242', - data: {'fraud_details': {'user_report': 'safe'}}, + data: {fraud_details: {user_report: 'safe'}}, headers: {}, }); }); diff --git a/test/resources/Checkout/Sessions.spec.js b/test/resources/Checkout/Sessions.spec.js index b0268ab786..2ab499b94f 100644 --- a/test/resources/Checkout/Sessions.spec.js +++ b/test/resources/Checkout/Sessions.spec.js @@ -1,14 +1,14 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Checkout', function () { - describe('Sessions Resource', function () { - describe('create', function() { - it('Sends the correct request', function() { - var params = { +describe('Checkout', () => { + describe('Sessions Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { + const params = { cancel_url: 'https://stripe.com/cancel', client_reference_id: '1234', line_items: [ @@ -16,9 +16,7 @@ describe('Checkout', function () { amount: 123, currency: 'usd', description: 'item 1', - images: [ - 'https://stripe.com/img1', - ], + images: ['https://stripe.com/img1'], name: 'name', quantity: 2, }, @@ -40,8 +38,8 @@ describe('Checkout', function () { }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.checkout.sessions.retrieve('cs_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/CountrySpecs.spec.js b/test/resources/CountrySpecs.spec.js index b896cdb91d..d5f6252aa4 100644 --- a/test/resources/CountrySpecs.spec.js +++ b/test/resources/CountrySpecs.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('CountrySpecs Resource', function() { - describe('list', function() { - it('Sends the correct request', function() { +describe('CountrySpecs Resource', () => { + describe('list', () => { + it('Sends the correct request', () => { stripe.countrySpecs.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,13 +16,13 @@ describe('CountrySpecs Resource', function() { }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { - var country = 'US'; + describe('retrieve', () => { + it('Sends the correct request', () => { + const country = 'US'; stripe.countrySpecs.retrieve(country); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/country_specs/' + country, + url: `/v1/country_specs/${country}`, data: {}, headers: {}, }); diff --git a/test/resources/Coupons.spec.js b/test/resources/Coupons.spec.js index 199845993e..f906a02d79 100644 --- a/test/resources/Coupons.spec.js +++ b/test/resources/Coupons.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Coupons Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Coupons Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.coupons.retrieve('couponId123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Coupons Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.coupons.del('couponId123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -28,8 +28,8 @@ describe('Coupons Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.coupons.update('couponId123', { metadata: {a: '1234'}, }); @@ -44,8 +44,8 @@ describe('Coupons Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.coupons.create({ percent_off: 25, duration: 'repeating', @@ -65,8 +65,8 @@ describe('Coupons Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.coupons.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/CreditNotes.spec.js b/test/resources/CreditNotes.spec.js index eb76a7aa16..025e01a176 100644 --- a/test/resources/CreditNotes.spec.js +++ b/test/resources/CreditNotes.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('CreditNotes Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('CreditNotes Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.creditNotes.retrieve('cn_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,9 +16,9 @@ describe('CreditNotes Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { - var data = { + describe('create', () => { + it('Sends the correct request', () => { + const data = { amount: 100, invoice: 'in_123', reason: 'duplicate', @@ -28,13 +28,13 @@ describe('CreditNotes Resource', function() { method: 'POST', url: '/v1/credit_notes', headers: {}, - data: data, + data, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.creditNotes.list({count: 25}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -45,8 +45,8 @@ describe('CreditNotes Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.creditNotes.update('cn_123', {application_fee: 200}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -57,14 +57,14 @@ describe('CreditNotes Resource', function() { }); }); - describe('voidCreditNote', function() { - it('Sends the correct request', function() { + describe('voidCreditNote', () => { + it('Sends the correct request', () => { stripe.creditNotes.voidCreditNote('cn_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/credit_notes/cn_123/void', headers: {}, - data: {} + data: {}, }); }); }); diff --git a/test/resources/CustomerCards.spec.js b/test/resources/CustomerCards.spec.js index 4c9708c472..4a9812f792 100644 --- a/test/resources/CustomerCards.spec.js +++ b/test/resources/CustomerCards.spec.js @@ -1,79 +1,79 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var CUSTOMER_TEST_ID = 'customerIdTest999'; +const CUSTOMER_TEST_ID = 'customerIdTest999'; // Create new CustomerCard instance with pre-filled customerId: -var customerCard = new resources.CustomerCards( - stripe, - {customerId: CUSTOMER_TEST_ID} -); +const customerCard = new resources.CustomerCards(stripe, { + customerId: CUSTOMER_TEST_ID, +}); // Use spy from existing resource: customerCard._request = stripe.customers._request; -describe('CustomerCard Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('CustomerCard Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { customerCard.retrieve('cardIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/cards/cardIdFoo456', + url: `/v1/customers/${CUSTOMER_TEST_ID}/cards/cardIdFoo456`, headers: {}, data: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { customerCard.create({ - number: '123456', exp_month: '12', + number: '123456', + exp_month: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/cards', + url: `/v1/customers/${CUSTOMER_TEST_ID}/cards`, headers: {}, data: {number: '123456', exp_month: '12'}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { customerCard.update('cardIdFoo456', { name: 'Bob M. Baz', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/cards/cardIdFoo456', + url: `/v1/customers/${CUSTOMER_TEST_ID}/cards/cardIdFoo456`, headers: {}, data: {name: 'Bob M. Baz'}, }); }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { customerCard.del('cardIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/cards/cardIdFoo456', + url: `/v1/customers/${CUSTOMER_TEST_ID}/cards/cardIdFoo456`, headers: {}, data: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { customerCard.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/cards', + url: `/v1/customers/${CUSTOMER_TEST_ID}/cards`, headers: {}, data: {}, }); diff --git a/test/resources/CustomerSubscriptions.spec.js b/test/resources/CustomerSubscriptions.spec.js index 461e19e137..842902464c 100644 --- a/test/resources/CustomerSubscriptions.spec.js +++ b/test/resources/CustomerSubscriptions.spec.js @@ -1,92 +1,96 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var CUSTOMER_TEST_ID = 'customerIdTest999'; +const CUSTOMER_TEST_ID = 'customerIdTest999'; // Create new CustomerSubscription instance with pre-filled customerId: -var customerSubscription = new resources.CustomerSubscriptions( - stripe, - {customerId: CUSTOMER_TEST_ID} -); +const customerSubscription = new resources.CustomerSubscriptions(stripe, { + customerId: CUSTOMER_TEST_ID, +}); // Use spy from existing resource: customerSubscription._request = stripe.customers._request; -describe('CustomerSubscription Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('CustomerSubscription Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { customerSubscription.retrieve('subscriptionIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/subscriptions/subscriptionIdFoo456', + url: `/v1/customers/${CUSTOMER_TEST_ID}/subscriptions/subscriptionIdFoo456`, headers: {}, data: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { customerSubscription.create({ - plan: 'gold', quantity: '12', + plan: 'gold', + quantity: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/subscriptions', + url: `/v1/customers/${CUSTOMER_TEST_ID}/subscriptions`, headers: {}, data: {plan: 'gold', quantity: '12'}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { customerSubscription.update('subscriptionIdFoo456', { name: 'Bob M. Baz', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/subscriptions/subscriptionIdFoo456', + url: `/v1/customers/${CUSTOMER_TEST_ID}/subscriptions/subscriptionIdFoo456`, headers: {}, data: {name: 'Bob M. Baz'}, }); }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { customerSubscription.del('subscriptionIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/subscriptions/subscriptionIdFoo456', + url: `/v1/customers/${CUSTOMER_TEST_ID}/subscriptions/subscriptionIdFoo456`, headers: {}, data: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { customerSubscription.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/subscriptions', + url: `/v1/customers/${CUSTOMER_TEST_ID}/subscriptions`, headers: {}, data: {}, }); }); }); - describe('Discount methods', function() { - describe('deleteDiscount', function() { - it('Sends the correct request', function() { - customerSubscription.deleteDiscount('customerIdFoo321', 'subscriptionIdBar654'); + describe('Discount methods', () => { + describe('deleteDiscount', () => { + it('Sends the correct request', () => { + customerSubscription.deleteDiscount( + 'customerIdFoo321', + 'subscriptionIdBar654' + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/customers/customerIdFoo321/subscriptions/subscriptionIdBar654/discount', + url: + '/v1/customers/customerIdFoo321/subscriptions/subscriptionIdBar654/discount', headers: {}, data: {}, }); diff --git a/test/resources/Customers.spec.js b/test/resources/Customers.spec.js index c895f740a1..ee3d0adf3b 100644 --- a/test/resources/Customers.spec.js +++ b/test/resources/Customers.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; +const TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; -describe('Customers Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Customers Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.customers.retrieve('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -17,7 +17,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.retrieve('cus_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -29,8 +29,8 @@ describe('Customers Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.customers.create({description: 'Some customer'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -40,7 +40,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.create({description: 'Some customer'}, TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -51,7 +51,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth and no body]', function() { + it('Sends the correct request [with specified auth and no body]', () => { stripe.customers.create(TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -62,8 +62,11 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified idempotency_key in options]', function() { - stripe.customers.create({description: 'Some customer'}, {idempotency_key: 'foo'}); + it('Sends the correct request [with specified idempotency_key in options]', () => { + stripe.customers.create( + {description: 'Some customer'}, + {idempotency_key: 'foo'} + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers', @@ -72,8 +75,11 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth in options]', function() { - stripe.customers.create({description: 'Some customer'}, {api_key: TEST_AUTH_KEY}); + it('Sends the correct request [with specified auth in options]', () => { + stripe.customers.create( + {description: 'Some customer'}, + {api_key: TEST_AUTH_KEY} + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers', @@ -83,8 +89,11 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth and idempotent key in options]', function() { - stripe.customers.create({description: 'Some customer'}, {api_key: TEST_AUTH_KEY, idempotency_key: 'foo'}); + it('Sends the correct request [with specified auth and idempotent key in options]', () => { + stripe.customers.create( + {description: 'Some customer'}, + {api_key: TEST_AUTH_KEY, idempotency_key: 'foo'} + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers', @@ -94,7 +103,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth in options and no body]', function() { + it('Sends the correct request [with specified auth in options and no body]', () => { stripe.customers.create({api_key: TEST_AUTH_KEY}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -106,8 +115,8 @@ describe('Customers Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.customers.update('cus_123', { description: 'Foo "baz"', }); @@ -120,8 +129,8 @@ describe('Customers Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.customers.del('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -132,8 +141,8 @@ describe('Customers Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.customers.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -143,7 +152,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.list(TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -155,9 +164,9 @@ describe('Customers Resource', function() { }); }); - describe('Subscription methods', function() { - describe('updateSubscription', function() { - it('Sends the correct request', function() { + describe('Subscription methods', () => { + describe('updateSubscription', () => { + it('Sends the correct request', () => { stripe.customers.updateSubscription('cus_123', { plan: 'fooPlan', }); @@ -169,10 +178,14 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.updateSubscription('cus_123', { - plan: 'fooPlan', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.updateSubscription( + 'cus_123', + { + plan: 'fooPlan', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers/cus_123/subscription', @@ -183,8 +196,8 @@ describe('Customers Resource', function() { }); }); - describe('cancelSubscription', function() { - it('Sends the correct request', function() { + describe('cancelSubscription', () => { + it('Sends the correct request', () => { stripe.customers.cancelSubscription('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -194,7 +207,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.cancelSubscription('cus_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -205,8 +218,8 @@ describe('Customers Resource', function() { }); }); - describe('With at_period_end defined', function() { - it('Sends the correct request', function() { + describe('With at_period_end defined', () => { + it('Sends the correct request', () => { stripe.customers.cancelSubscription('cus_123', {at_period_end: true}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -217,9 +230,13 @@ describe('Customers Resource', function() { }); }); - describe('With at_period_end defined [with specified auth]', function() { - it('Sends the correct request', function() { - stripe.customers.cancelSubscription('cus_123', {at_period_end: true}, TEST_AUTH_KEY); + describe('With at_period_end defined [with specified auth]', () => { + it('Sends the correct request', () => { + stripe.customers.cancelSubscription( + 'cus_123', + {at_period_end: true}, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', url: '/v1/customers/cus_123/subscription', @@ -232,9 +249,9 @@ describe('Customers Resource', function() { }); }); - describe('Discount methods', function() { - describe('deleteDiscount', function() { - it('Sends the correct request', function() { + describe('Discount methods', () => { + describe('deleteDiscount', () => { + it('Sends the correct request', () => { stripe.customers.deleteDiscount('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -245,8 +262,8 @@ describe('Customers Resource', function() { }); }); - describe('deleteSubscriptionDiscount', function() { - it('Sends the correct request', function() { + describe('deleteSubscriptionDiscount', () => { + it('Sends the correct request', () => { stripe.customers.deleteSubscriptionDiscount('cus_123', 'sub_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -258,10 +275,10 @@ describe('Customers Resource', function() { }); }); - describe('Metadata methods', function() { - describe('setMetadata', function() { - describe('When deleting metadata', function() { - it('Sends the correct request', function() { + describe('Metadata methods', () => { + describe('setMetadata', () => { + describe('When deleting metadata', () => { + it('Sends the correct request', () => { stripe.customers.setMetadata('cus_123', null); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -274,21 +291,25 @@ describe('Customers Resource', function() { }); }); - describe('When setting new metadata', function() { - it('Sends one request to get current, and another to set new data', function() { - return expect(new Promise(function(resolve, reject) { - stripe.customers.setMetadata('cus_123', { - foo: 123, - baz: 456, - }).then(function() { - var reqs = stripe.REQUESTS; - resolve([ - // Last two requests - reqs[reqs.length - 2], - reqs[reqs.length - 1], - ]); - }); - })).to.eventually.deep.equal([ + describe('When setting new metadata', () => { + it('Sends one request to get current, and another to set new data', () => + expect( + new Promise((resolve, reject) => { + stripe.customers + .setMetadata('cus_123', { + foo: 123, + baz: 456, + }) + .then(() => { + const reqs = stripe.REQUESTS; + resolve([ + // Last two requests + reqs[reqs.length - 2], + reqs[reqs.length - 1], + ]); + }); + }) + ).to.eventually.deep.equal([ { // First reset metadata: method: 'POST', @@ -305,12 +326,11 @@ describe('Customers Resource', function() { metadata: {foo: 123, baz: 456}, }, }, - ]); - }); + ])); }); - describe('When setting with an auth key', function() { - it('Sends the correct request, including the specified auth key', function() { + describe('When setting with an auth key', () => { + it('Sends the correct request, including the specified auth key', () => { stripe.customers.setMetadata('cus_123', null, TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -346,9 +366,9 @@ describe('Customers Resource', function() { }); }); - describe('Card methods', function() { - describe('retrieveCard', function() { - it('Sends the correct request', function() { + describe('Card methods', () => { + describe('retrieveCard', () => { + it('Sends the correct request', () => { stripe.customers.retrieveCard('cus_123', 'card_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -358,7 +378,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.retrieveCard('cus_123', 'card_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -370,10 +390,11 @@ describe('Customers Resource', function() { }); }); - describe('createCard', function() { - it('Sends the correct request', function() { + describe('createCard', () => { + it('Sends the correct request', () => { stripe.customers.createCard('cus_123', { - number: '123456', exp_month: '12', + number: '123456', + exp_month: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -383,10 +404,15 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.createCard('cus_123', { - number: '123456', exp_month: '12', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.createCard( + 'cus_123', + { + number: '123456', + exp_month: '12', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers/cus_123/cards', @@ -397,8 +423,8 @@ describe('Customers Resource', function() { }); }); - describe('updateCard', function() { - it('Sends the correct request', function() { + describe('updateCard', () => { + it('Sends the correct request', () => { stripe.customers.updateCard('cus_123', 'card_123', { name: 'Bob M. Baz', }); @@ -411,8 +437,8 @@ describe('Customers Resource', function() { }); }); - describe('deleteCard', function() { - it('Sends the correct request', function() { + describe('deleteCard', () => { + it('Sends the correct request', () => { stripe.customers.deleteCard('cus_123', 'card_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -422,7 +448,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.deleteCard('cus_123', 'card_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -434,8 +460,8 @@ describe('Customers Resource', function() { }); }); - describe('listCards', function() { - it('Sends the correct request', function() { + describe('listCards', () => { + it('Sends the correct request', () => { stripe.customers.listCards('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -445,7 +471,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.listCards('cus_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -458,9 +484,9 @@ describe('Customers Resource', function() { }); }); - describe('Source methods', function() { - describe('retrieveSource', function() { - it('Sends the correct request', function() { + describe('Source methods', () => { + describe('retrieveSource', () => { + it('Sends the correct request', () => { stripe.customers.retrieveSource('cus_123', 'card_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -470,7 +496,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.retrieveSource('cus_123', 'card_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -482,10 +508,12 @@ describe('Customers Resource', function() { }); }); - describe('createSource', function() { - it('Sends the correct request', function() { + describe('createSource', () => { + it('Sends the correct request', () => { stripe.customers.createSource('cus_123', { - object: 'card', number: '123456', exp_month: '12', + object: 'card', + number: '123456', + exp_month: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -495,10 +523,16 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.createSource('cus_123', { - object: 'card', number: '123456', exp_month: '12', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.createSource( + 'cus_123', + { + object: 'card', + number: '123456', + exp_month: '12', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers/cus_123/sources', @@ -509,8 +543,8 @@ describe('Customers Resource', function() { }); }); - describe('updateSource', function() { - it('Sends the correct request', function() { + describe('updateSource', () => { + it('Sends the correct request', () => { stripe.customers.updateSource('cus_123', 'card_123', { name: 'Bob M. Baz', }); @@ -523,8 +557,8 @@ describe('Customers Resource', function() { }); }); - describe('deleteSource', function() { - it('Sends the correct request', function() { + describe('deleteSource', () => { + it('Sends the correct request', () => { stripe.customers.deleteSource('cus_123', 'card_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -534,7 +568,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.deleteSource('cus_123', 'card_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -546,8 +580,8 @@ describe('Customers Resource', function() { }); }); - describe('listSources', function() { - it('Sends the correct request', function() { + describe('listSources', () => { + it('Sends the correct request', () => { stripe.customers.listSources('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -557,7 +591,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.listSources('cus_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -569,25 +603,30 @@ describe('Customers Resource', function() { }); }); - describe('verifySource', function() { - it('Sends the correct request', function() { - var data = {amounts: [32,45]} + describe('verifySource', () => { + it('Sends the correct request', () => { + const data = {amounts: [32, 45]}; - stripe.customers.verifySource('cus_123', 'card_123', data, TEST_AUTH_KEY); + stripe.customers.verifySource( + 'cus_123', + 'card_123', + data, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers/cus_123/sources/card_123/verify', headers: {}, - data: data, + data, auth: TEST_AUTH_KEY, - }) + }); }); }); }); - describe('Subscription methods', function() { - describe('retrieveSubscription', function() { - it('Sends the correct request', function() { + describe('Subscription methods', () => { + describe('retrieveSubscription', () => { + it('Sends the correct request', () => { stripe.customers.retrieveSubscription('cus_123', 'sub_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -597,8 +636,12 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.retrieveSubscription('cus_123', 'sub_123', TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.retrieveSubscription( + 'cus_123', + 'sub_123', + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/customers/cus_123/subscriptions/sub_123', @@ -609,10 +652,11 @@ describe('Customers Resource', function() { }); }); - describe('createSubscription', function() { - it('Sends the correct request', function() { + describe('createSubscription', () => { + it('Sends the correct request', () => { stripe.customers.createSubscription('cus_123', { - plan: 'gold', quantity: '12', + plan: 'gold', + quantity: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -622,10 +666,15 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.createSubscription('cus_123', { - plan: 'gold', quantity: '12', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.createSubscription( + 'cus_123', + { + plan: 'gold', + quantity: '12', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers/cus_123/subscriptions', @@ -636,8 +685,8 @@ describe('Customers Resource', function() { }); }); - describe('updateSubscription (new-style api)', function() { - it('Sends the correct request', function() { + describe('updateSubscription (new-style api)', () => { + it('Sends the correct request', () => { stripe.customers.updateSubscription('cus_123', 'sub_123', { quantity: '2', }); @@ -649,10 +698,15 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.updateSubscription('cus_123', 'sub_123', { - quantity: '2', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.updateSubscription( + 'cus_123', + 'sub_123', + { + quantity: '2', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/customers/cus_123/subscriptions/sub_123', @@ -663,8 +717,8 @@ describe('Customers Resource', function() { }); }); - describe('cancelSubscription (new-style api)', function() { - it('Sends the correct request', function() { + describe('cancelSubscription (new-style api)', () => { + it('Sends the correct request', () => { stripe.customers.cancelSubscription('cus_123', 'sub_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -674,8 +728,12 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.customers.cancelSubscription('cus_123', 'sub_123', TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.customers.cancelSubscription( + 'cus_123', + 'sub_123', + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', url: '/v1/customers/cus_123/subscriptions/sub_123', @@ -685,9 +743,11 @@ describe('Customers Resource', function() { }); }); - describe('With at_period_end defined', function() { - it('Sends the correct request', function() { - stripe.customers.cancelSubscription('cus_123', 'sub_123', {at_period_end: true}); + describe('With at_period_end defined', () => { + it('Sends the correct request', () => { + stripe.customers.cancelSubscription('cus_123', 'sub_123', { + at_period_end: true, + }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', url: '/v1/customers/cus_123/subscriptions/sub_123', @@ -697,8 +757,8 @@ describe('Customers Resource', function() { }); }); - describe('With at_period_end defined [with specified auth]', function() { - it('Sends the correct request', function() { + describe('With at_period_end defined [with specified auth]', () => { + it('Sends the correct request', () => { stripe.customers.cancelSubscription( 'cus_123', 'sub_123', @@ -716,8 +776,8 @@ describe('Customers Resource', function() { }); }); - describe('listSubscriptions', function() { - it('Sends the correct request', function() { + describe('listSubscriptions', () => { + it('Sends the correct request', () => { stripe.customers.listSubscriptions('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -727,7 +787,7 @@ describe('Customers Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.customers.listSubscriptions('cus_123', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -740,9 +800,9 @@ describe('Customers Resource', function() { }); }); - describe('TaxId methods', function() { - describe('retrieveTaxId', function() { - it('Sends the correct request', function() { + describe('TaxId methods', () => { + describe('retrieveTaxId', () => { + it('Sends the correct request', () => { stripe.customers.retrieveTaxId('cus_123', 'txi_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -753,9 +813,9 @@ describe('Customers Resource', function() { }); }); - describe('createTaxId', function() { - it('Sends the correct request', function() { - var data = { + describe('createTaxId', () => { + it('Sends the correct request', () => { + const data = { type: 'eu_vat', value: '11111', }; @@ -764,13 +824,13 @@ describe('Customers Resource', function() { method: 'POST', url: '/v1/customers/cus_123/tax_ids', headers: {}, - data: data, + data, }); }); }); - describe('deleteTaxId', function() { - it('Sends the correct request', function() { + describe('deleteTaxId', () => { + it('Sends the correct request', () => { stripe.customers.deleteTaxId('cus_123', 'txi_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -781,8 +841,8 @@ describe('Customers Resource', function() { }); }); - describe('listTaxIds', function() { - it('Sends the correct request', function() { + describe('listTaxIds', () => { + it('Sends the correct request', () => { stripe.customers.listTaxIds('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Disputes.spec.js b/test/resources/Disputes.spec.js index d227adfe3d..6bee3ed7f8 100644 --- a/test/resources/Disputes.spec.js +++ b/test/resources/Disputes.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Dispute Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Dispute Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.disputes.retrieve('dp_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Dispute Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.disputes.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -28,8 +28,8 @@ describe('Dispute Resource', function() { }); }); - describe('close', function() { - it('Sends the correct request', function() { + describe('close', () => { + it('Sends the correct request', () => { stripe.disputes.close('dp_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -40,8 +40,8 @@ describe('Dispute Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.disputes.update('dp_123', {evidence: {customer_name: 'Bob'}}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/EphemeralKeys.spec.js b/test/resources/EphemeralKeys.spec.js index 565a066186..1a5a2ca171 100644 --- a/test/resources/EphemeralKeys.spec.js +++ b/test/resources/EphemeralKeys.spec.js @@ -1,7 +1,7 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; function errorsOnNoStripeVersion() { return expect( @@ -27,9 +27,9 @@ function sendsCorrectStripeVersion() { }); } -describe('EphemeralKey Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('EphemeralKey Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { stripe.ephemeralKeys.create( {customer: 'cus_123'}, {stripe_version: '2017-05-25'} @@ -46,7 +46,7 @@ describe('EphemeralKey Resource', function() { }); }); - describe('when an api version is set', function() { + describe('when an api version is set', () => { beforeEach(function() { this.oldVersion = stripe.getApiField('version'); stripe.setApiVersion('2017-05-25'); @@ -56,16 +56,15 @@ describe('EphemeralKey Resource', function() { stripe.setApiVersion(this.oldVersion); }); - it('Errors if no stripe-version is specified', function() { - return errorsOnNoStripeVersion(); - }); + it('Errors if no stripe-version is specified', () => + errorsOnNoStripeVersion()); - it('Sends the correct stripe-version', function() { + it('Sends the correct stripe-version', () => { sendsCorrectStripeVersion(); }); }); - describe('when no api version is set', function() { + describe('when no api version is set', () => { beforeEach(function() { this.oldVersion = stripe.getApiField('version'); stripe.setApiVersion(null); @@ -75,18 +74,17 @@ describe('EphemeralKey Resource', function() { stripe.setApiVersion(this.oldVersion); }); - it('Errors if no stripe-version is specified', function() { - return errorsOnNoStripeVersion(); - }); + it('Errors if no stripe-version is specified', () => + errorsOnNoStripeVersion()); - it('Sends the correct stripe-version', function() { + it('Sends the correct stripe-version', () => { sendsCorrectStripeVersion(); }); }); }); - describe('delete', function() { - it('Sends the correct request', function() { + describe('delete', () => { + it('Sends the correct request', () => { stripe.ephemeralKeys.del('ephkey_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', diff --git a/test/resources/Events.spec.js b/test/resources/Events.spec.js index c5e77fdfdb..28fbe98ed4 100644 --- a/test/resources/Events.spec.js +++ b/test/resources/Events.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Events Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Events Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.events.retrieve('eventIdBaz'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Events Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.events.list({count: 25}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/ExchangeRates.spec.js b/test/resources/ExchangeRates.spec.js index 9f7108b77f..233119cd57 100644 --- a/test/resources/ExchangeRates.spec.js +++ b/test/resources/ExchangeRates.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('ExchangeRates Resource', function() { - describe('list', function() { - it('Sends the correct request', function() { +describe('ExchangeRates Resource', () => { + describe('list', () => { + it('Sends the correct request', () => { stripe.exchangeRates.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,13 +16,13 @@ describe('ExchangeRates Resource', function() { }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { - var currency = 'USD'; + describe('retrieve', () => { + it('Sends the correct request', () => { + const currency = 'USD'; stripe.exchangeRates.retrieve(currency); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/exchange_rates/' + currency, + url: `/v1/exchange_rates/${currency}`, data: {}, headers: {}, }); diff --git a/test/resources/FileLinks.spec.js b/test/resources/FileLinks.spec.js index 8bf6677b21..1071d22ec0 100644 --- a/test/resources/FileLinks.spec.js +++ b/test/resources/FileLinks.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('FileLinks Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('FileLinks Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.fileLinks.retrieve('link_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('FileLinks Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.fileLinks.create({file: 'file_123'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -28,8 +28,8 @@ describe('FileLinks Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.fileLinks.update('link_123', {metadata: {key: 'value'}}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -40,8 +40,8 @@ describe('FileLinks Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.fileLinks.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/FileUploads.spec.js b/test/resources/FileUploads.spec.js index c8ea6bb6dd..06669b84ed 100644 --- a/test/resources/FileUploads.spec.js +++ b/test/resources/FileUploads.spec.js @@ -1,15 +1,15 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; -var fs = require('fs'); -var path = require('path'); +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; +const fs = require('fs'); +const path = require('path'); -var TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; +const TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; -describe('File Uploads Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('File Uploads Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.fileUploads.retrieve('fil_12345'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -19,7 +19,7 @@ describe('File Uploads Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.fileUploads.retrieve('fil_12345', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -31,8 +31,8 @@ describe('File Uploads Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.fileUploads.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -43,10 +43,10 @@ describe('File Uploads Resource', function() { }); }); - describe('create', function() { - it('Sends the correct file upload request', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.readFileSync(testFilename); + describe('create', () => { + it('Sends the correct file upload request', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.readFileSync(testFilename); stripe.fileUploads.create({ purpose: 'dispute_evidence', @@ -63,19 +63,22 @@ describe('File Uploads Resource', function() { expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); }); - it('Sends the correct file upload request [with specified auth]', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.readFileSync(testFilename); + it('Sends the correct file upload request [with specified auth]', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.readFileSync(testFilename); - stripe.fileUploads.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', + stripe.fileUploads.create( + { + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + file_link_data: {create: true}, }, - file_link_data: {create: true}, - }, TEST_AUTH_KEY); + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.property('host', 'files.stripe.com'); expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); @@ -83,43 +86,53 @@ describe('File Uploads Resource', function() { expect(stripe.LAST_REQUEST).to.deep.property('auth', TEST_AUTH_KEY); }); - it('Streams a file and sends the correct file upload request', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.createReadStream(testFilename); + it('Streams a file and sends the correct file upload request', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.createReadStream(testFilename); - return stripe.fileUploads.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - file_link_data: {create: true}, - }).then(function() { - expect(stripe.LAST_REQUEST).to.deep.property('host', 'files.stripe.com'); - expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); - expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); - }); + return stripe.fileUploads + .create({ + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + file_link_data: {create: true}, + }) + .then(() => { + expect(stripe.LAST_REQUEST).to.deep.property( + 'host', + 'files.stripe.com' + ); + expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); + expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); + }); }); - it('Streams a file and sends the correct file upload request [with specified auth]', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.createReadStream(testFilename); + it('Streams a file and sends the correct file upload request [with specified auth]', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.createReadStream(testFilename); - return stripe.fileUploads.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - file_link_data: {create: true}, - }, TEST_AUTH_KEY).then(function() { - expect(stripe.LAST_REQUEST).to.deep.property('host', 'files.stripe.com'); - expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); - expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); - expect(stripe.LAST_REQUEST).to.deep.property('auth', TEST_AUTH_KEY); - }); + return stripe.fileUploads + .create( + { + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + file_link_data: {create: true}, + }, + TEST_AUTH_KEY + ) + .then(() => { + expect(stripe.LAST_REQUEST).to.deep.property( + 'host', + 'files.stripe.com' + ); + }); }); }); }); diff --git a/test/resources/Files.spec.js b/test/resources/Files.spec.js index 215652cec1..52487ffe07 100644 --- a/test/resources/Files.spec.js +++ b/test/resources/Files.spec.js @@ -1,15 +1,15 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; -var fs = require('fs'); -var path = require('path'); +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; +const fs = require('fs'); +const path = require('path'); -var TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; +const TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; -describe('Files Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Files Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.files.retrieve('fil_12345'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -19,7 +19,7 @@ describe('Files Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.files.retrieve('fil_12345', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -31,8 +31,8 @@ describe('Files Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.files.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -43,10 +43,10 @@ describe('Files Resource', function() { }); }); - describe('create', function() { - it('Sends the correct file upload request', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.readFileSync(testFilename); + describe('create', () => { + it('Sends the correct file upload request', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.readFileSync(testFilename); stripe.files.create({ purpose: 'dispute_evidence', @@ -63,19 +63,22 @@ describe('Files Resource', function() { expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); }); - it('Sends the correct file upload request [with specified auth]', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.readFileSync(testFilename); + it('Sends the correct file upload request [with specified auth]', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.readFileSync(testFilename); - stripe.files.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', + stripe.files.create( + { + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + file_link_data: {create: true}, }, - file_link_data: {create: true}, - }, TEST_AUTH_KEY); + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.property('host', 'files.stripe.com'); expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); @@ -83,43 +86,56 @@ describe('Files Resource', function() { expect(stripe.LAST_REQUEST).to.deep.property('auth', TEST_AUTH_KEY); }); - it('Streams a file and sends the correct file upload request', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.createReadStream(testFilename); + it('Streams a file and sends the correct file upload request', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.createReadStream(testFilename); - return stripe.files.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - file_link_data: {create: true}, - }).then(function() { - expect(stripe.LAST_REQUEST).to.deep.property('host', 'files.stripe.com'); - expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); - expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); - }); + return stripe.files + .create({ + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + file_link_data: {create: true}, + }) + .then(() => { + expect(stripe.LAST_REQUEST).to.deep.property( + 'host', + 'files.stripe.com' + ); + expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); + expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); + }); }); - it('Streams a file and sends the correct file upload request [with specified auth]', function() { - var testFilename = path.join(__dirname, 'data/minimal.pdf'); - var f = fs.createReadStream(testFilename); + it('Streams a file and sends the correct file upload request [with specified auth]', () => { + const testFilename = path.join(__dirname, 'data/minimal.pdf'); + const f = fs.createReadStream(testFilename); - return stripe.files.create({ - purpose: 'dispute_evidence', - file: { - data: f, - name: 'minimal.pdf', - type: 'application/octet-stream', - }, - file_link_data: {create: true}, - }, TEST_AUTH_KEY).then(function() { - expect(stripe.LAST_REQUEST).to.deep.property('host', 'files.stripe.com'); - expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); - expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); - expect(stripe.LAST_REQUEST).to.deep.property('auth', TEST_AUTH_KEY); - }); + return stripe.files + .create( + { + purpose: 'dispute_evidence', + file: { + data: f, + name: 'minimal.pdf', + type: 'application/octet-stream', + }, + file_link_data: {create: true}, + }, + TEST_AUTH_KEY + ) + .then(() => { + expect(stripe.LAST_REQUEST).to.deep.property( + 'host', + 'files.stripe.com' + ); + expect(stripe.LAST_REQUEST).to.deep.property('method', 'POST'); + expect(stripe.LAST_REQUEST).to.deep.property('url', '/v1/files'); + expect(stripe.LAST_REQUEST).to.deep.property('auth', TEST_AUTH_KEY); + }); }); }); }); diff --git a/test/resources/InvoiceItems.spec.js b/test/resources/InvoiceItems.spec.js index 6a6352968a..61de4fd338 100644 --- a/test/resources/InvoiceItems.spec.js +++ b/test/resources/InvoiceItems.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('InvoiceItems Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('InvoiceItems Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.invoiceItems.retrieve('invoiceItemIdTesting123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('InvoiceItems Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.invoiceItems.create({ customer: 'cust_id_888', }); @@ -30,8 +30,8 @@ describe('InvoiceItems Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.invoiceItems.update('invoiceItemId1', { amount: 1900, }); @@ -44,8 +44,8 @@ describe('InvoiceItems Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.invoiceItems.del('invoiceItemId2'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -56,8 +56,8 @@ describe('InvoiceItems Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.invoiceItems.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Invoices.spec.js b/test/resources/Invoices.spec.js index 980e24bcd8..b6598d8c38 100644 --- a/test/resources/Invoices.spec.js +++ b/test/resources/Invoices.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Invoices Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Invoices Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.invoices.retrieve('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Invoices Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.invoices.create({application_fee: 111}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -28,8 +28,8 @@ describe('Invoices Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.invoices.list({count: 25}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -40,8 +40,8 @@ describe('Invoices Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.invoices.update('in_123', {application_fee: 200}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -52,8 +52,8 @@ describe('Invoices Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.invoices.del('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -64,8 +64,8 @@ describe('Invoices Resource', function() { }); }); - describe('retrieveLines', function() { - it('Sends the correct request', function() { + describe('retrieveLines', () => { + it('Sends the correct request', () => { stripe.invoices.retrieveLines('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -76,9 +76,9 @@ describe('Invoices Resource', function() { }); }); - describe('retrieveUpcoming', function() { - describe('With just a customer ID', function() { - it('Sends the correct request', function() { + describe('retrieveUpcoming', () => { + describe('With just a customer ID', () => { + it('Sends the correct request', () => { stripe.invoices.retrieveUpcoming('cus_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -89,8 +89,8 @@ describe('Invoices Resource', function() { }); }); - describe('With a subscription ID in addition to a customer ID', function() { - it('Sends the correct request', function() { + describe('With a subscription ID in addition to a customer ID', () => { + it('Sends the correct request', () => { stripe.invoices.retrieveUpcoming('cus_123', 'sub_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -101,18 +101,16 @@ describe('Invoices Resource', function() { }); }); - describe('With an options object that includes `subscription_items`', function() { - it('Sends the correct request', function() { + describe('With an options object that includes `subscription_items`', () => { + it('Sends the correct request', () => { stripe.invoices.retrieveUpcoming('cus_123', { - subscription_items: [ - {plan: 'potato'}, - {plan: 'rutabaga'}, - ], + subscription_items: [{plan: 'potato'}, {plan: 'rutabaga'}], }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/invoices/upcoming?customer=cus_123&' + + url: + '/v1/invoices/upcoming?customer=cus_123&' + 'subscription_items[0][plan]=potato&subscription_items[1][plan]=rutabaga', headers: {}, data: {}, @@ -120,19 +118,17 @@ describe('Invoices Resource', function() { }); }); - describe('Without a customer id but options', function() { - it('Sends the correct request', function() { + describe('Without a customer id but options', () => { + it('Sends the correct request', () => { stripe.invoices.retrieveUpcoming({ customer: 'cus_abc', - subscription_items: [ - {plan: 'potato'}, - {plan: 'rutabaga'}, - ], + subscription_items: [{plan: 'potato'}, {plan: 'rutabaga'}], }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/invoices/upcoming?customer=cus_abc&' + + url: + '/v1/invoices/upcoming?customer=cus_abc&' + 'subscription_items[0][plan]=potato&subscription_items[1][plan]=rutabaga', headers: {}, data: {}, @@ -140,17 +136,16 @@ describe('Invoices Resource', function() { }); }); - describe('With an options object that includes `subscription_items` in addition to a subscription ID', function() { - it('Sends the correct request', function() { - stripe.invoices.retrieveUpcoming('cus_123', 'sub_123', - { - subscription_items: [ - {plan: 'potato'}, - {plan: 'rutabaga'}, - {id: 'SOME_ID', deleted: true}, - ], - subscription_prorate: true, - }); + describe('With an options object that includes `subscription_items` in addition to a subscription ID', () => { + it('Sends the correct request', () => { + stripe.invoices.retrieveUpcoming('cus_123', 'sub_123', { + subscription_items: [ + {plan: 'potato'}, + {plan: 'rutabaga'}, + {id: 'SOME_ID', deleted: true}, + ], + subscription_prorate: true, + }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -168,8 +163,8 @@ describe('Invoices Resource', function() { }); }); - describe('With a options object in addition to a customer ID', function() { - it('Sends the correct request', function() { + describe('With a options object in addition to a customer ID', () => { + it('Sends the correct request', () => { stripe.invoices.retrieveUpcoming('cus_123', {plan: 'planId123'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -181,33 +176,32 @@ describe('Invoices Resource', function() { }); }); - describe('finalizeInvoice', function() { - it('Sends the correct request', function() { + describe('finalizeInvoice', () => { + it('Sends the correct request', () => { stripe.invoices.finalizeInvoice('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/invoices/in_123/finalize', headers: {}, - data: {} + data: {}, }); }); }); - describe('mark uncollectible', function() { - it('Sends the correct request', function() { + describe('mark uncollectible', () => { + it('Sends the correct request', () => { stripe.invoices.markUncollectible('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/invoices/in_123/mark_uncollectible', headers: {}, - data: {} + data: {}, }); }); }); - - describe('pay', function() { - it('Sends the correct request', function() { + describe('pay', () => { + it('Sends the correct request', () => { stripe.invoices.pay('in_123', { source: 'tok_FooBar', }); @@ -220,26 +214,26 @@ describe('Invoices Resource', function() { }); }); - describe('sendInvoice', function() { - it('Sends the correct request', function() { + describe('sendInvoice', () => { + it('Sends the correct request', () => { stripe.invoices.sendInvoice('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/invoices/in_123/send', headers: {}, - data: {} + data: {}, }); }); }); - describe('voidInvoice', function() { - it('Sends the correct request', function() { + describe('voidInvoice', () => { + it('Sends the correct request', () => { stripe.invoices.voidInvoice('in_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/invoices/in_123/void', headers: {}, - data: {} + data: {}, }); }); }); diff --git a/test/resources/IssuerFraudRecords.spec.js b/test/resources/IssuerFraudRecords.spec.js index 46842348c7..6a4bd87265 100644 --- a/test/resources/IssuerFraudRecords.spec.js +++ b/test/resources/IssuerFraudRecords.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('IssuerFraudRecord Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('IssuerFraudRecord Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuerFraudRecords.retrieve('issfr_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('IssuerFraudRecord Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.issuerFraudRecords.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Issuing/Authorization.spec.js b/test/resources/Issuing/Authorization.spec.js index b4eb56de4c..e58774d59f 100644 --- a/test/resources/Issuing/Authorization.spec.js +++ b/test/resources/Issuing/Authorization.spec.js @@ -1,12 +1,12 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Issuing', function () { - describe('Authorization Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Issuing', () => { + describe('Authorization Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuing.authorizations.retrieve('iauth_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -17,8 +17,8 @@ describe('Issuing', function () { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.issuing.authorizations.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -29,12 +29,12 @@ describe('Issuing', function () { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.issuing.authorizations.update('iauth_123', { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -44,15 +44,15 @@ describe('Issuing', function () { data: { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }, }); }); }); - describe('approve', function() { - it('Sends the correct request', function() { + describe('approve', () => { + it('Sends the correct request', () => { stripe.issuing.authorizations.approve('iauth_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -63,8 +63,8 @@ describe('Issuing', function () { }); }); - describe('decline', function() { - it('Sends the correct request', function() { + describe('decline', () => { + it('Sends the correct request', () => { stripe.issuing.authorizations.decline('iauth_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/Issuing/Cardholders.spec.js b/test/resources/Issuing/Cardholders.spec.js index b854cd592c..16bf3b531b 100644 --- a/test/resources/Issuing/Cardholders.spec.js +++ b/test/resources/Issuing/Cardholders.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Issuing', function () { - describe('Cardholders Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Issuing', () => { + describe('Cardholders Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuing.cardholders.retrieve('ich_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Issuing', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.issuing.cardholders.create({ billing: {}, name: 'Tim Testperson', @@ -39,12 +39,12 @@ describe('Issuing', function () { }); }); - describe('update', function () { - it('Sends the correct request', function () { + describe('update', () => { + it('Sends the correct request', () => { stripe.issuing.cardholders.update('ich_123', { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -54,15 +54,15 @@ describe('Issuing', function () { data: { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }, }); }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.issuing.cardholders.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Issuing/Cards.spec.js b/test/resources/Issuing/Cards.spec.js index 8cf312a16c..551667064b 100644 --- a/test/resources/Issuing/Cards.spec.js +++ b/test/resources/Issuing/Cards.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Issuing', function () { - describe('Cards Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Issuing', () => { + describe('Cards Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuing.cards.retrieve('ic_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Issuing', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.issuing.cards.create({ currency: 'usd', type: 'physical', @@ -37,12 +37,12 @@ describe('Issuing', function () { }); }); - describe('update', function () { - it('Sends the correct request', function () { + describe('update', () => { + it('Sends the correct request', () => { stripe.issuing.cards.update('ic_123', { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -52,15 +52,15 @@ describe('Issuing', function () { data: { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }, }); }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.issuing.cards.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -72,9 +72,9 @@ describe('Issuing', function () { }); }); - describe('Virtual Cards Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { + describe('Virtual Cards Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuing.cards.retrieveDetails('ic_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ diff --git a/test/resources/Issuing/Disputes.spec.js b/test/resources/Issuing/Disputes.spec.js index dcb5ac6eb2..4ae2d3ac5a 100644 --- a/test/resources/Issuing/Disputes.spec.js +++ b/test/resources/Issuing/Disputes.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Issuing', function () { - describe('Disputes Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Issuing', () => { + describe('Disputes Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuing.disputes.retrieve('idp_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Issuing', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.issuing.disputes.create({ transaction: 'ipi_123', }); @@ -35,12 +35,12 @@ describe('Issuing', function () { }); }); - describe('update', function () { - it('Sends the correct request', function () { + describe('update', () => { + it('Sends the correct request', () => { stripe.issuing.disputes.update('idp_123', { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -50,15 +50,15 @@ describe('Issuing', function () { data: { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }, }); }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.issuing.disputes.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Issuing/Transactions.spec.js b/test/resources/Issuing/Transactions.spec.js index ca44877232..2fa9854d56 100644 --- a/test/resources/Issuing/Transactions.spec.js +++ b/test/resources/Issuing/Transactions.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Issuing', function () { - describe('Transactions Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Issuing', () => { + describe('Transactions Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.issuing.transactions.retrieve('ipi_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,12 +19,12 @@ describe('Issuing', function () { }); }); - describe('update', function () { - it('Sends the correct request', function () { + describe('update', () => { + it('Sends the correct request', () => { stripe.issuing.transactions.update('ipi_123', { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -34,15 +34,15 @@ describe('Issuing', function () { data: { metadata: { thing1: true, - thing2: 'yes' + thing2: 'yes', }, }, }); }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.issuing.transactions.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/LoginLinks.spec.js b/test/resources/LoginLinks.spec.js index b796a4356e..f8c6c36183 100644 --- a/test/resources/LoginLinks.spec.js +++ b/test/resources/LoginLinks.spec.js @@ -1,27 +1,24 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var ACCOUNT_ID = 'acct_EXPRESS'; +const ACCOUNT_ID = 'acct_EXPRESS'; // Create new LoginLink instance with pre-filled accountId: -var loginLink = new resources.LoginLinks( - stripe, - {accountId: ACCOUNT_ID} -); +const loginLink = new resources.LoginLinks(stripe, {accountId: ACCOUNT_ID}); // Use spy from existing resource: loginLink._request = stripe.customers._request; -describe('LoginLink Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('LoginLink Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { loginLink.create(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/accounts/' + ACCOUNT_ID + '/login_links', + url: `/v1/accounts/${ACCOUNT_ID}/login_links`, headers: {}, data: {}, }); diff --git a/test/resources/OAuth.spec.js b/test/resources/OAuth.spec.js index 5f21e48eea..c04af14f3c 100644 --- a/test/resources/OAuth.spec.js +++ b/test/resources/OAuth.spec.js @@ -1,38 +1,38 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); +const stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; -var URL = require('url'); -var qs = require('qs'); +const expect = require('chai').expect; +const URL = require('url'); +const qs = require('qs'); -describe('OAuth', function() { - describe('authorize', function() { - describe('when a default client_id is set', function() { - beforeEach(function() { +describe('OAuth', () => { + describe('authorize', () => { + describe('when a default client_id is set', () => { + beforeEach(() => { stripe.setClientId('default_client_id'); }); - it('Uses the correct host', function() { - var url = stripe.oauth.authorizeUrl(); + it('Uses the correct host', () => { + const url = stripe.oauth.authorizeUrl(); - var host = URL.parse(url).hostname; + const host = URL.parse(url).hostname; expect(host).to.equal('connect.stripe.com'); }); - it('Uses the correct path', function() { - var url = stripe.oauth.authorizeUrl({state: 'some_state'}); + it('Uses the correct path', () => { + const url = stripe.oauth.authorizeUrl({state: 'some_state'}); - var pathname = URL.parse(url).pathname; + const pathname = URL.parse(url).pathname; expect(pathname).to.equal('/oauth/authorize'); }); - it('Uses the correct query', function() { - var url = stripe.oauth.authorizeUrl({state: 'some_state'}); + it('Uses the correct query', () => { + const url = stripe.oauth.authorizeUrl({state: 'some_state'}); - var query = qs.parse(URL.parse(url).query) + const query = qs.parse(URL.parse(url).query); expect(query.client_id).to.equal('default_client_id'); expect(query.response_type).to.equal('code'); @@ -40,19 +40,19 @@ describe('OAuth', function() { expect(query.state).to.equal('some_state'); }); - it('Uses a provided client_id instead of the default', function() { - var url = stripe.oauth.authorizeUrl({client_id: '123abc'}); + it('Uses a provided client_id instead of the default', () => { + const url = stripe.oauth.authorizeUrl({client_id: '123abc'}); - var query = qs.parse(URL.parse(url).query) + const query = qs.parse(URL.parse(url).query); expect(query.client_id).to.equal('123abc'); }); - describe('for Express account', function() { - it('Uses the correct path', function() { - var url = stripe.oauth.authorizeUrl({}, {express: true}); + describe('for Express account', () => { + it('Uses the correct path', () => { + const url = stripe.oauth.authorizeUrl({}, {express: true}); - var pathname = URL.parse(url).pathname; + const pathname = URL.parse(url).pathname; expect(pathname).to.equal('/express/oauth/authorize'); }); @@ -60,11 +60,11 @@ describe('OAuth', function() { }); }); - describe('token', function() { - it('Sends the correct request', function() { + describe('token', () => { + it('Sends the correct request', () => { stripe.oauth.token({ code: '123abc', - grant_type: 'authorization_code' + grant_type: 'authorization_code', }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -74,18 +74,18 @@ describe('OAuth', function() { headers: {}, data: { code: '123abc', - grant_type: 'authorization_code' + grant_type: 'authorization_code', }, }); }); }); - describe('deauthorize', function() { - beforeEach(function() { + describe('deauthorize', () => { + beforeEach(() => { stripe.setClientId('default_client_id'); }); - it('Sends the correct request without explicit client_id', function() { + it('Sends the correct request without explicit client_id', () => { stripe.oauth.deauthorize({ stripe_user_id: 'some_user_id', }); @@ -97,12 +97,12 @@ describe('OAuth', function() { headers: {}, data: { client_id: stripe.getClientId(), - stripe_user_id: 'some_user_id' + stripe_user_id: 'some_user_id', }, }); }); - it('Sends the correct request with explicit client_id', function() { + it('Sends the correct request with explicit client_id', () => { stripe.oauth.deauthorize({ stripe_user_id: 'some_user_id', client_id: '123abc', @@ -115,7 +115,7 @@ describe('OAuth', function() { headers: {}, data: { client_id: '123abc', - stripe_user_id: 'some_user_id' + stripe_user_id: 'some_user_id', }, }); }); diff --git a/test/resources/OrderReturns.spec.js b/test/resources/OrderReturns.spec.js index 2dff709fe9..f39052edb2 100644 --- a/test/resources/OrderReturns.spec.js +++ b/test/resources/OrderReturns.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('OrderReturn Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('OrderReturn Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.orderReturns.retrieve('orderReturnIdFoo123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('OrderReturn Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.orderReturns.list({ limit: 3, }); @@ -31,7 +31,7 @@ describe('OrderReturn Resource', function() { }); }); - it('Supports filtering by order', function() { + it('Supports filtering by order', () => { stripe.orderReturns.list({ order: 'orderIdFoo123', }); diff --git a/test/resources/Orders.spec.js b/test/resources/Orders.spec.js index 092d6de8d2..c367271577 100644 --- a/test/resources/Orders.spec.js +++ b/test/resources/Orders.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Order Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Order Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.orders.retrieve('orderIdFoo123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Order Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.orders.create({ currency: 'usd', items: [ @@ -56,10 +56,10 @@ describe('Order Resource', function() { headers: {}, }); }); - }) + }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.orders.list({ limit: 3, }); @@ -73,7 +73,7 @@ describe('Order Resource', function() { }); }); - it('Supports filtering by status', function() { + it('Supports filtering by status', () => { stripe.orders.list({ status: 'active', }); @@ -88,8 +88,8 @@ describe('Order Resource', function() { }); }); - describe('pay', function() { - it('Sends the correct request', function() { + describe('pay', () => { + it('Sends the correct request', () => { stripe.orders.pay('orderIdFoo3242', { source: 'tok_FooBar', }); @@ -102,12 +102,10 @@ describe('Order Resource', function() { }); }); - describe('returnOrder', function() { - it('Sends the correct request', function() { + describe('returnOrder', () => { + it('Sends the correct request', () => { stripe.orders.returnOrder('orderIdFoo3242', { - items: [ - {parent: 'sku_123'}, - ], + items: [{parent: 'sku_123'}], }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -118,8 +116,8 @@ describe('Order Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.orders.update('orderIdFoo3242', {status: 'fulfilled'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/PaymentIntents.spec.js b/test/resources/PaymentIntents.spec.js index 81f8f2c639..757b900ff5 100644 --- a/test/resources/PaymentIntents.spec.js +++ b/test/resources/PaymentIntents.spec.js @@ -1,14 +1,14 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var PAYMENT_INTENT_TEST_ID = 'pi_123'; +const PAYMENT_INTENT_TEST_ID = 'pi_123'; -describe('Payment Intents Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { - var params = { +describe('Payment Intents Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { + const params = { amount: 200, currency: 'usd', payment_method_types: ['card'], @@ -23,8 +23,8 @@ describe('Payment Intents Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.paymentIntents.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -35,62 +35,62 @@ describe('Payment Intents Resource', function() { }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.paymentIntents.retrieve(PAYMENT_INTENT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/payment_intents/' + PAYMENT_INTENT_TEST_ID, + url: `/v1/payment_intents/${PAYMENT_INTENT_TEST_ID}`, headers: {}, data: {}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.paymentIntents.update(PAYMENT_INTENT_TEST_ID, { metadata: {key: 'value'}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/payment_intents/' + PAYMENT_INTENT_TEST_ID, + url: `/v1/payment_intents/${PAYMENT_INTENT_TEST_ID}`, headers: {}, data: {metadata: {key: 'value'}}, }); }); }); - describe('cancel', function() { - it('Sends the correct request', function() { + describe('cancel', () => { + it('Sends the correct request', () => { stripe.paymentIntents.cancel(PAYMENT_INTENT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/payment_intents/' + PAYMENT_INTENT_TEST_ID + '/cancel', + url: `/v1/payment_intents/${PAYMENT_INTENT_TEST_ID}/cancel`, headers: {}, data: {}, }); }); }); - describe('capture', function() { - it('Sends the correct request', function() { + describe('capture', () => { + it('Sends the correct request', () => { stripe.paymentIntents.capture(PAYMENT_INTENT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/payment_intents/' + PAYMENT_INTENT_TEST_ID + '/capture', + url: `/v1/payment_intents/${PAYMENT_INTENT_TEST_ID}/capture`, headers: {}, data: {}, }); }); }); - describe('confirm', function() { - it('Sends the correct request', function() { + describe('confirm', () => { + it('Sends the correct request', () => { stripe.paymentIntents.confirm(PAYMENT_INTENT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/payment_intents/' + PAYMENT_INTENT_TEST_ID + '/confirm', + url: `/v1/payment_intents/${PAYMENT_INTENT_TEST_ID}/confirm`, headers: {}, data: {}, }); diff --git a/test/resources/PaymentMethods.spec.js b/test/resources/PaymentMethods.spec.js index 8106dce73b..0860c1cb45 100644 --- a/test/resources/PaymentMethods.spec.js +++ b/test/resources/PaymentMethods.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('PaymentMethods Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('PaymentMethods Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.paymentMethods.retrieve('pm_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,9 +16,9 @@ describe('PaymentMethods Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { - var data = { + describe('create', () => { + it('Sends the correct request', () => { + const data = { type: 'card', }; stripe.paymentMethods.create(data); @@ -26,14 +26,14 @@ describe('PaymentMethods Resource', function() { method: 'POST', url: '/v1/payment_methods', headers: {}, - data: data, + data, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { - var data = { + describe('list', () => { + it('Sends the correct request', () => { + const data = { customer: 'cus_123', type: 'card', }; @@ -42,14 +42,14 @@ describe('PaymentMethods Resource', function() { method: 'GET', url: '/v1/payment_methods', headers: {}, - data: data, + data, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { - var data = { + describe('update', () => { + it('Sends the correct request', () => { + const data = { metadata: {key: 'value'}, }; stripe.paymentMethods.update('pm_123', data); @@ -57,31 +57,31 @@ describe('PaymentMethods Resource', function() { method: 'POST', url: '/v1/payment_methods/pm_123', headers: {}, - data: data, + data, }); }); }); - describe('attach', function() { - it('Sends the correct request', function() { + describe('attach', () => { + it('Sends the correct request', () => { stripe.paymentMethods.attach('pm_123', {customer: 'cus_123'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/payment_methods/pm_123/attach', headers: {}, - data: {customer: 'cus_123'} + data: {customer: 'cus_123'}, }); }); }); - describe('detach', function() { - it('Sends the correct request', function() { + describe('detach', () => { + it('Sends the correct request', () => { stripe.paymentMethods.detach('pm_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/payment_methods/pm_123/detach', headers: {}, - data: {} + data: {}, }); }); }); diff --git a/test/resources/Payouts.spec.js b/test/resources/Payouts.spec.js index 9d4f92b648..1f1678acae 100644 --- a/test/resources/Payouts.spec.js +++ b/test/resources/Payouts.spec.js @@ -1,27 +1,28 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var PAYOUT_TEST_ID = 'po_testid1'; +const PAYOUT_TEST_ID = 'po_testid1'; -describe('Payouts Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Payouts Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.payouts.retrieve(PAYOUT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/payouts/' + PAYOUT_TEST_ID, + url: `/v1/payouts/${PAYOUT_TEST_ID}`, headers: {}, data: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.payouts.create({ - amount: 200, currency: 'usd', + amount: 200, + currency: 'usd', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -32,34 +33,34 @@ describe('Payouts Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.payouts.update(PAYOUT_TEST_ID, { metadata: {key: 'value'}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/payouts/' + PAYOUT_TEST_ID, + url: `/v1/payouts/${PAYOUT_TEST_ID}`, headers: {}, data: {metadata: {key: 'value'}}, }); }); }); - describe('cancel', function() { - it('Sends the correct request', function() { + describe('cancel', () => { + it('Sends the correct request', () => { stripe.payouts.cancel(PAYOUT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/payouts/' + PAYOUT_TEST_ID + '/cancel', + url: `/v1/payouts/${PAYOUT_TEST_ID}/cancel`, headers: {}, data: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.payouts.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -70,12 +71,12 @@ describe('Payouts Resource', function() { }); }); - describe('listTransactions', function() { - it('Sends the correct request', function() { + describe('listTransactions', () => { + it('Sends the correct request', () => { stripe.payouts.listTransactions(PAYOUT_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/payouts/' + PAYOUT_TEST_ID + '/transactions', + url: `/v1/payouts/${PAYOUT_TEST_ID}/transactions`, headers: {}, data: {}, }); diff --git a/test/resources/Persons.spec.js b/test/resources/Persons.spec.js index 0a355d0ad8..0b199f6715 100644 --- a/test/resources/Persons.spec.js +++ b/test/resources/Persons.spec.js @@ -1,84 +1,80 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var ACCOUNT_TEST_ID = 'acct_123'; -var PERSON_TEST_ID = 'person_123'; +const ACCOUNT_TEST_ID = 'acct_123'; +const PERSON_TEST_ID = 'person_123'; // Create new Person instance with pre-filled accountId: -var person = new resources.Persons( - stripe, - {accountId: ACCOUNT_TEST_ID} -); +const person = new resources.Persons(stripe, {accountId: ACCOUNT_TEST_ID}); // Use spy from existing resource: person._request = stripe.customers._request; -describe('Person Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('Person Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { person.create({ first_name: 'John', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/accounts/' + ACCOUNT_TEST_ID + '/persons', + url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons`, data: {first_name: 'John'}, headers: {}, }); }); }); - describe('delete', function() { - it('Sends the correct request', function() { + describe('delete', () => { + it('Sends the correct request', () => { person.del(PERSON_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/accounts/' + ACCOUNT_TEST_ID + '/persons/' + PERSON_TEST_ID, + url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons/${PERSON_TEST_ID}`, data: {}, headers: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { person.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/accounts/' + ACCOUNT_TEST_ID + '/persons', + url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons`, data: {}, headers: {}, }); }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { person.retrieve(PERSON_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/accounts/' + ACCOUNT_TEST_ID + '/persons/' + PERSON_TEST_ID, + url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons/${PERSON_TEST_ID}`, data: {}, headers: {}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { person.update(PERSON_TEST_ID, { first_name: 'John', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/accounts/' + ACCOUNT_TEST_ID + '/persons/' + PERSON_TEST_ID, + url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons/${PERSON_TEST_ID}`, data: {first_name: 'John'}, headers: {}, }); }); }); }); - diff --git a/test/resources/Plans.spec.js b/test/resources/Plans.spec.js index d231ddb6b6..85f9226fdc 100644 --- a/test/resources/Plans.spec.js +++ b/test/resources/Plans.spec.js @@ -1,55 +1,55 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Plans Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Plans Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.plans.retrieve('planId1'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/plans/planId1', headers: {}, - data: {} + data: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.plans.create({ amount: 200, - currency: 'usd' + currency: 'usd', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/plans', headers: {}, - data: {amount: 200, currency: 'usd'} + data: {amount: 200, currency: 'usd'}, }); }); - it('Sends the correct request for metered', function() { + it('Sends the correct request for metered', () => { stripe.plans.create({ amount: 200, currency: 'usd', - usage_type: 'metered' + usage_type: 'metered', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/plans', headers: {}, - data: {amount: 200, currency: 'usd', usage_type: 'metered'} + data: {amount: 200, currency: 'usd', usage_type: 'metered'}, }); }); - it('Sends the correct request for tiered plans', function() { + it('Sends the correct request for tiered plans', () => { stripe.plans.create({ currency: 'usd', billing_scheme: 'tiered', tiers: [{up_to: 123, amount: 100}, {up_to: 'inf', amount: 200}], - tiers_mode: 'volume' + tiers_mode: 'volume', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -59,16 +59,16 @@ describe('Plans Resource', function() { currency: 'usd', billing_scheme: 'tiered', tiers: [{up_to: 123, amount: 100}, {up_to: 'inf', amount: 200}], - tiers_mode: 'volume' - } + tiers_mode: 'volume', + }, }); }); - it('Sends the correct request for transform usage plans', function() { + it('Sends the correct request for transform usage plans', () => { stripe.plans.create({ amount: 200, currency: 'usd', - transform_usage: {divide_by: 123, round: 'up'} + transform_usage: {divide_by: 123, round: 'up'}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -77,47 +77,47 @@ describe('Plans Resource', function() { data: { amount: 200, currency: 'usd', - transform_usage: {divide_by: 123, round: 'up'} - } + transform_usage: {divide_by: 123, round: 'up'}, + }, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.plans.update('planId3', { amount: 1900, - currency: 'usd' + currency: 'usd', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/plans/planId3', headers: {}, - data: {amount: 1900, currency: 'usd'} + data: {amount: 1900, currency: 'usd'}, }); }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.plans.del('planId4'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', url: '/v1/plans/planId4', headers: {}, - data: {} + data: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.plans.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/plans', headers: {}, - data: {} + data: {}, }); }); }); diff --git a/test/resources/Products.spec.js b/test/resources/Products.spec.js index 274f82ecac..21c6193521 100644 --- a/test/resources/Products.spec.js +++ b/test/resources/Products.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Product Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Product Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.products.retrieve('productIdFoo123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Product Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.products.create({ name: 'Llamas', active: true, @@ -34,10 +34,10 @@ describe('Product Resource', function() { headers: {}, }); }); - }) + }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.products.list({ limit: 3, }); @@ -51,7 +51,7 @@ describe('Product Resource', function() { }); }); - it('Supports filtering by shippable', function() { + it('Supports filtering by shippable', () => { stripe.products.list({ shippable: true, }); @@ -66,8 +66,8 @@ describe('Product Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.products.update('productIdFoo3242', {caption: 'test'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -78,8 +78,8 @@ describe('Product Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.products.del('productIdFoo3242'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', diff --git a/test/resources/Radar/ValueListItems.spec.js b/test/resources/Radar/ValueListItems.spec.js index 3ce40f3e17..286ef956ba 100644 --- a/test/resources/Radar/ValueListItems.spec.js +++ b/test/resources/Radar/ValueListItems.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Radar', function () { - describe('ValueLists Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Radar', () => { + describe('ValueLists Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.radar.valueListItems.retrieve('rsli_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Radar', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.radar.valueListItems.create({ value_list: 'rsl_123', value: 'value', @@ -37,8 +37,8 @@ describe('Radar', function () { }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.radar.valueListItems.list({ value_list: 'rsl_123', }); @@ -53,8 +53,8 @@ describe('Radar', function () { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.radar.valueListItems.del('rsli_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', diff --git a/test/resources/Radar/ValueLists.spec.js b/test/resources/Radar/ValueLists.spec.js index 8c3743af5e..57c778257e 100644 --- a/test/resources/Radar/ValueLists.spec.js +++ b/test/resources/Radar/ValueLists.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Radar', function () { - describe('ValueLists Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Radar', () => { + describe('ValueLists Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.radar.valueLists.retrieve('rsl_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Radar', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.radar.valueLists.create({ alias: 'alias', name: 'name', @@ -37,8 +37,8 @@ describe('Radar', function () { }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.radar.valueLists.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -49,8 +49,8 @@ describe('Radar', function () { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.radar.valueLists.del('rsl_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -61,8 +61,8 @@ describe('Radar', function () { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.radar.valueLists.update('rsl_123', { metadata: {a: '1234'}, }); diff --git a/test/resources/RecipientCards.spec.js b/test/resources/RecipientCards.spec.js index 85475fd93a..885b974912 100644 --- a/test/resources/RecipientCards.spec.js +++ b/test/resources/RecipientCards.spec.js @@ -1,79 +1,79 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var RECIPIENT_TEST_ID = 'recipientIdTest999'; +const RECIPIENT_TEST_ID = 'recipientIdTest999'; // Create new recipientCard instance with pre-filled recipientId: -var recipientCard = new resources.RecipientCards( - stripe, - {recipientId: RECIPIENT_TEST_ID} -); +const recipientCard = new resources.RecipientCards(stripe, { + recipientId: RECIPIENT_TEST_ID, +}); // Use spy from existing resource: recipientCard._request = stripe.recipients._request; -describe('RecipientCard Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('RecipientCard Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { recipientCard.retrieve('cardIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/recipients/' + RECIPIENT_TEST_ID + '/cards/cardIdFoo456', + url: `/v1/recipients/${RECIPIENT_TEST_ID}/cards/cardIdFoo456`, headers: {}, data: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { recipientCard.create({ - number: '123456', exp_month: '12', + number: '123456', + exp_month: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/recipients/' + RECIPIENT_TEST_ID + '/cards', + url: `/v1/recipients/${RECIPIENT_TEST_ID}/cards`, headers: {}, data: {number: '123456', exp_month: '12'}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { recipientCard.update('cardIdFoo456', { name: 'Bob M. Baz', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/recipients/' + RECIPIENT_TEST_ID + '/cards/cardIdFoo456', + url: `/v1/recipients/${RECIPIENT_TEST_ID}/cards/cardIdFoo456`, headers: {}, data: {name: 'Bob M. Baz'}, }); }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { recipientCard.del('cardIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/recipients/' + RECIPIENT_TEST_ID + '/cards/cardIdFoo456', + url: `/v1/recipients/${RECIPIENT_TEST_ID}/cards/cardIdFoo456`, headers: {}, data: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { recipientCard.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/recipients/' + RECIPIENT_TEST_ID + '/cards', + url: `/v1/recipients/${RECIPIENT_TEST_ID}/cards`, headers: {}, data: {}, }); diff --git a/test/resources/Recipients.spec.js b/test/resources/Recipients.spec.js index 51350d079b..8ee3f33fe1 100644 --- a/test/resources/Recipients.spec.js +++ b/test/resources/Recipients.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; +const TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; -describe('Recipients Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Recipients Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.recipients.retrieve('recipientId1'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -18,10 +18,11 @@ describe('Recipients Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.recipients.create({ - name: 'Bob', type: 'individual', + name: 'Bob', + type: 'individual', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -32,8 +33,8 @@ describe('Recipients Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.recipients.update('recipientId3', { name: 'Bob Smith', }); @@ -46,8 +47,8 @@ describe('Recipients Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.recipients.del('recipientId4'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -58,8 +59,8 @@ describe('Recipients Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.recipients.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -70,9 +71,9 @@ describe('Recipients Resource', function() { }); }); - describe('Card methods', function() { - describe('retrieveCard', function() { - it('Sends the correct request', function() { + describe('Card methods', () => { + describe('retrieveCard', () => { + it('Sends the correct request', () => { stripe.recipients.retrieveCard('recipientIdFoo321', 'cardIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -82,8 +83,12 @@ describe('Recipients Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.recipients.retrieveCard('recipientIdFoo321', 'cardIdFoo456', TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.recipients.retrieveCard( + 'recipientIdFoo321', + 'cardIdFoo456', + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', @@ -94,10 +99,11 @@ describe('Recipients Resource', function() { }); }); - describe('createCard', function() { - it('Sends the correct request', function() { + describe('createCard', () => { + it('Sends the correct request', () => { stripe.recipients.createCard('recipientIdFoo321', { - number: '123456', exp_month: '12', + number: '123456', + exp_month: '12', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -107,10 +113,15 @@ describe('Recipients Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.recipients.createCard('recipientIdFoo321', { - number: '123456', exp_month: '12', - }, TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.recipients.createCard( + 'recipientIdFoo321', + { + number: '123456', + exp_month: '12', + }, + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/recipients/recipientIdFoo321/cards', @@ -121,8 +132,8 @@ describe('Recipients Resource', function() { }); }); - describe('updateCard', function() { - it('Sends the correct request', function() { + describe('updateCard', () => { + it('Sends the correct request', () => { stripe.recipients.updateCard('recipientIdFoo321', 'cardIdFoo456', { name: 'Bob M. Baz', }); @@ -135,8 +146,8 @@ describe('Recipients Resource', function() { }); }); - describe('deleteCard', function() { - it('Sends the correct request', function() { + describe('deleteCard', () => { + it('Sends the correct request', () => { stripe.recipients.deleteCard('recipientIdFoo321', 'cardIdFoo456'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -146,8 +157,12 @@ describe('Recipients Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { - stripe.recipients.deleteCard('recipientIdFoo321', 'cardIdFoo456', TEST_AUTH_KEY); + it('Sends the correct request [with specified auth]', () => { + stripe.recipients.deleteCard( + 'recipientIdFoo321', + 'cardIdFoo456', + TEST_AUTH_KEY + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', @@ -158,8 +173,8 @@ describe('Recipients Resource', function() { }); }); - describe('listCards', function() { - it('Sends the correct request', function() { + describe('listCards', () => { + it('Sends the correct request', () => { stripe.recipients.listCards('recipientIdFoo321'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -169,7 +184,7 @@ describe('Recipients Resource', function() { }); }); - it('Sends the correct request [with specified auth]', function() { + it('Sends the correct request [with specified auth]', () => { stripe.recipients.listCards('recipientIdFoo321', TEST_AUTH_KEY); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Refunds.spec.js b/test/resources/Refunds.spec.js index f47550f01b..843477d149 100644 --- a/test/resources/Refunds.spec.js +++ b/test/resources/Refunds.spec.js @@ -1,15 +1,15 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Refund Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('Refund Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { stripe.refunds.create({ amount: '300', charge: 'ch_123', - }) + }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -23,8 +23,8 @@ describe('Refund Resource', function() { }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.refunds.retrieve('re_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -35,8 +35,8 @@ describe('Refund Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.refunds.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -47,8 +47,8 @@ describe('Refund Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.refunds.update('re_123', {metadata: {key: 'abcd'}}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/Reporting/ReportRuns.spec.js b/test/resources/Reporting/ReportRuns.spec.js index fa6cb522cc..dd83a00854 100644 --- a/test/resources/Reporting/ReportRuns.spec.js +++ b/test/resources/Reporting/ReportRuns.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Reporting', function () { - describe('ReportRuns Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Reporting', () => { + describe('ReportRuns Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.reporting.reportRuns.retrieve('frr_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Reporting', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.reporting.reportRuns.create({ parameters: { connected_account: 'acct_123', @@ -41,8 +41,8 @@ describe('Reporting', function () { }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.reporting.reportRuns.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Reporting/ReportTypes.spec.js b/test/resources/Reporting/ReportTypes.spec.js index 75b99d4d60..37e7bd3134 100644 --- a/test/resources/Reporting/ReportTypes.spec.js +++ b/test/resources/Reporting/ReportTypes.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Reporting', function () { - describe('ReportTypes Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Reporting', () => { + describe('ReportTypes Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.reporting.reportTypes.retrieve('activity.summary.1'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Reporting', function () { }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.reporting.reportTypes.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Reviews.spec.js b/test/resources/Reviews.spec.js index 850473afec..03296088aa 100644 --- a/test/resources/Reviews.spec.js +++ b/test/resources/Reviews.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Review Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Review Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.reviews.retrieve('prv_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Review Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.reviews.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -28,8 +28,8 @@ describe('Review Resource', function() { }); }); - describe('approve', function() { - it('Sends the correct request', function() { + describe('approve', () => { + it('Sends the correct request', () => { stripe.reviews.approve('prv_123', {amount: 23}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/SKUs.spec.js b/test/resources/SKUs.spec.js index 24ce99437d..5155d8fec8 100644 --- a/test/resources/SKUs.spec.js +++ b/test/resources/SKUs.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('SKU Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('SKU Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.skus.retrieve('skuIdFoo123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('SKU Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.skus.create({ currency: 'usd', inventory: {type: 'finite', quantity: 500}, @@ -38,10 +38,10 @@ describe('SKU Resource', function() { headers: {}, }); }); - }) + }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.skus.list({ limit: 3, }); @@ -55,7 +55,7 @@ describe('SKU Resource', function() { }); }); - it('Supports filtering by product', function() { + it('Supports filtering by product', () => { stripe.skus.list({ product: 'prodId123', }); @@ -70,8 +70,8 @@ describe('SKU Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.skus.update('skuIdFoo3242', {caption: 'test'}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -82,8 +82,8 @@ describe('SKU Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.skus.del('skuIdFoo3242'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', diff --git a/test/resources/Sigma/ScheduledQueryRuns.spec.js b/test/resources/Sigma/ScheduledQueryRuns.spec.js index 88e81ce2b1..710762d8e0 100644 --- a/test/resources/Sigma/ScheduledQueryRuns.spec.js +++ b/test/resources/Sigma/ScheduledQueryRuns.spec.js @@ -1,12 +1,12 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Sigma', function () { - describe('ScheduledQueryRun Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Sigma', () => { + describe('ScheduledQueryRun Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.sigma.scheduledQueryRuns.retrieve('sqr_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -17,8 +17,8 @@ describe('Sigma', function () { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.sigma.scheduledQueryRuns.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Sources.spec.js b/test/resources/Sources.spec.js index 51d7111539..89da485560 100644 --- a/test/resources/Sources.spec.js +++ b/test/resources/Sources.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Sources Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Sources Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.sources.retrieve('sourceId1'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Sources Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.sources.create({ amount: 200, currency: 'usd', @@ -46,8 +46,8 @@ describe('Sources Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.sources.update('src_foo', { metadata: {foo: 'bar'}, }); @@ -60,8 +60,8 @@ describe('Sources Resource', function() { }); }); - describe('listSourceTransactions', function() { - it('Sends the correct request', function() { + describe('listSourceTransactions', () => { + it('Sends the correct request', () => { stripe.sources.listSourceTransactions('src_foo'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -72,8 +72,8 @@ describe('Sources Resource', function() { }); }); - describe('verify', function() { - it('Sends the correct request', function() { + describe('verify', () => { + it('Sends the correct request', () => { stripe.sources.verify('src_foo', {values: [32, 45]}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/SubscriptionItems.spec.js b/test/resources/SubscriptionItems.spec.js index 76b1c598b3..73e59d58c2 100644 --- a/test/resources/SubscriptionItems.spec.js +++ b/test/resources/SubscriptionItems.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('SubscriptionItems Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('SubscriptionItems Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.subscriptionItems.retrieve('test_sub_item'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('SubscriptionItems Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.subscriptionItems.del('test_sub_item'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -28,8 +28,8 @@ describe('SubscriptionItems Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.subscriptionItems.update('test_sub_item', { plan: 'gold', }); @@ -44,8 +44,8 @@ describe('SubscriptionItems Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.subscriptionItems.create({ subscription: 'test_sub', plan: 'gold', @@ -63,8 +63,8 @@ describe('SubscriptionItems Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.subscriptionItems.list({ limit: 3, subscription: 'test_sub', diff --git a/test/resources/SubscriptionSchedule.spec.js b/test/resources/SubscriptionSchedule.spec.js index b38246c129..68107b3382 100644 --- a/test/resources/SubscriptionSchedule.spec.js +++ b/test/resources/SubscriptionSchedule.spec.js @@ -1,44 +1,44 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var SCHEDULE_TEST_ID = 'sub_sched_123'; -var REVISION_TEST_ID = 'sub_sched_rev_123'; +const SCHEDULE_TEST_ID = 'sub_sched_123'; +const REVISION_TEST_ID = 'sub_sched_rev_123'; -describe('Subscription Schedule Resource', function() { - describe('cancel', function() { - it('Sends the correct request', function() { - var data = { +describe('Subscription Schedule Resource', () => { + describe('cancel', () => { + it('Sends the correct request', () => { + const data = { invoice_now: true, - } + }; stripe.subscriptionSchedules.cancel(SCHEDULE_TEST_ID, data); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID + '/cancel', - data: data, + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/cancel`, + data, headers: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { - var data = { + describe('create', () => { + it('Sends the correct request', () => { + const data = { customer: 'cus_123', }; stripe.subscriptionSchedules.create(data); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/subscription_schedules', - data: data, + data, headers: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.subscriptionSchedules.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -49,23 +49,23 @@ describe('Subscription Schedule Resource', function() { }); }); - describe('release', function() { - it('Sends the correct request', function() { - var data = { + describe('release', () => { + it('Sends the correct request', () => { + const data = { preserve_cancel_date: true, - } + }; stripe.subscriptionSchedules.release(SCHEDULE_TEST_ID, data); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID + '/release', - data: data, + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/release`, + data, headers: {}, }); }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.subscriptionSchedules.retrieve(SCHEDULE_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -76,38 +76,41 @@ describe('Subscription Schedule Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { - var data = {metadata: {key: 'value'}}; + describe('update', () => { + it('Sends the correct request', () => { + const data = {metadata: {key: 'value'}}; stripe.subscriptionSchedules.update(SCHEDULE_TEST_ID, data); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID, - data: data, + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}`, + data, headers: {}, }); }); }); - describe('Revision methods', function() { - describe('retrieveRevision', function() { - it('Sends the correct request', function() { - stripe.subscriptionSchedules.retrieveRevision(SCHEDULE_TEST_ID, REVISION_TEST_ID); + describe('Revision methods', () => { + describe('retrieveRevision', () => { + it('Sends the correct request', () => { + stripe.subscriptionSchedules.retrieveRevision( + SCHEDULE_TEST_ID, + REVISION_TEST_ID + ); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID + '/revisions/' + REVISION_TEST_ID, + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/revisions/${REVISION_TEST_ID}`, headers: {}, data: {}, }); }); }); - describe('listRevisions', function() { - it('Sends the correct request', function() { + describe('listRevisions', () => { + it('Sends the correct request', () => { stripe.subscriptionSchedules.listRevisions(SCHEDULE_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID + '/revisions', + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/revisions`, headers: {}, data: {}, }); diff --git a/test/resources/SubscriptionScheduleRevision.spec.js b/test/resources/SubscriptionScheduleRevision.spec.js index bbc76a5e1b..4c15320d7a 100644 --- a/test/resources/SubscriptionScheduleRevision.spec.js +++ b/test/resources/SubscriptionScheduleRevision.spec.js @@ -1,44 +1,42 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var SCHEDULE_TEST_ID = 'sub_sched_123'; -var REVISION_TEST_ID = 'sub_sched_rev_123'; +const SCHEDULE_TEST_ID = 'sub_sched_123'; +const REVISION_TEST_ID = 'sub_sched_rev_123'; // Create new SubscriptionScheduleRevision instance with pre-filled scheduleId: -var revision = new resources.SubscriptionScheduleRevisions( - stripe, - {scheduleId: SCHEDULE_TEST_ID} -); +const revision = new resources.SubscriptionScheduleRevisions(stripe, { + scheduleId: SCHEDULE_TEST_ID, +}); // Use spy from existing resource: revision._request = stripe.customers._request; -describe('SubscriptionScheduleRevision Resource', function() { - describe('list', function() { - it('Sends the correct request', function() { +describe('SubscriptionScheduleRevision Resource', () => { + describe('list', () => { + it('Sends the correct request', () => { revision.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID + '/revisions', + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/revisions`, data: {}, headers: {}, }); }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { revision.retrieve(REVISION_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/subscription_schedules/' + SCHEDULE_TEST_ID + '/revisions/' + REVISION_TEST_ID, + url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/revisions/${REVISION_TEST_ID}`, data: {}, headers: {}, }); }); }); }); - diff --git a/test/resources/Subscriptions.spec.js b/test/resources/Subscriptions.spec.js index 8e732dab61..d1f7631295 100644 --- a/test/resources/Subscriptions.spec.js +++ b/test/resources/Subscriptions.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('subscriptions Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('subscriptions Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.subscriptions.retrieve('test_sub'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('subscriptions Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.subscriptions.del('test_sub'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -28,8 +28,8 @@ describe('subscriptions Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.subscriptions.update('test_sub', { metadata: {a: '1234'}, }); @@ -44,8 +44,8 @@ describe('subscriptions Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.subscriptions.create({ customer: 'test_cus', plan: 'gold', @@ -63,8 +63,8 @@ describe('subscriptions Resource', function() { }); }); - describe('update with items array', function() { - it('Sends the correct request', function() { + describe('update with items array', () => { + it('Sends the correct request', () => { stripe.subscriptions.update('test_sub', { items: [ { @@ -89,8 +89,8 @@ describe('subscriptions Resource', function() { }); }); - describe('create with items array', function() { - it('Sends the correct request', function() { + describe('create with items array', () => { + it('Sends the correct request', () => { stripe.subscriptions.create({ items: [ { @@ -116,8 +116,8 @@ describe('subscriptions Resource', function() { }); }); - describe('update with items object', function() { - it('Sends the correct request', function() { + describe('update with items object', () => { + it('Sends the correct request', () => { stripe.subscriptions.update('test_sub', { items: { '0': { @@ -133,8 +133,8 @@ describe('subscriptions Resource', function() { data: { items: { '0': { - 'plan': 'foo', - 'quantity': 2, + plan: 'foo', + quantity: 2, }, }, }, @@ -142,8 +142,8 @@ describe('subscriptions Resource', function() { }); }); - describe('create with items object', function() { - it('Sends the correct request', function() { + describe('create with items object', () => { + it('Sends the correct request', () => { stripe.subscriptions.create({ items: { '0': { @@ -160,8 +160,8 @@ describe('subscriptions Resource', function() { data: { items: { '0': { - 'plan': 'foo', - 'quantity': 2, + plan: 'foo', + quantity: 2, }, }, }, @@ -169,8 +169,8 @@ describe('subscriptions Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.subscriptions.list({ limit: 3, customer: 'test_cus', @@ -189,9 +189,9 @@ describe('subscriptions Resource', function() { }); }); - describe('Discount methods', function() { - describe('deleteDiscount', function() { - it('Sends the correct request', function() { + describe('Discount methods', () => { + describe('deleteDiscount', () => { + it('Sends the correct request', () => { stripe.subscriptions.deleteDiscount('test_sub'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', diff --git a/test/resources/TaxIds.spec.js b/test/resources/TaxIds.spec.js index 4de4cf2804..fda30f9faa 100644 --- a/test/resources/TaxIds.spec.js +++ b/test/resources/TaxIds.spec.js @@ -1,67 +1,64 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var CUSTOMER_TEST_ID = 'cus_123'; -var TAX_ID_TEST_ID = 'txi_123'; +const CUSTOMER_TEST_ID = 'cus_123'; +const TAX_ID_TEST_ID = 'txi_123'; -var taxId = new resources.TaxIds( - stripe, - {customerId: CUSTOMER_TEST_ID} -); +const taxId = new resources.TaxIds(stripe, {customerId: CUSTOMER_TEST_ID}); // Use spy from existing resource: taxId._request = stripe.customers._request; -describe('TaxId Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { - var data = { +describe('TaxId Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { + const data = { type: 'eu_vat', value: '11111', }; taxId.create(data); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/tax_ids', - data: data, + url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids`, + data, headers: {}, }); }); }); - describe('delete', function() { - it('Sends the correct request', function() { + describe('delete', () => { + it('Sends the correct request', () => { taxId.del(TAX_ID_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/tax_ids/' + TAX_ID_TEST_ID, + url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids/${TAX_ID_TEST_ID}`, data: {}, headers: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { taxId.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/tax_ids', + url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids`, data: {}, headers: {}, }); }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { taxId.retrieve(TAX_ID_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/customers/' + CUSTOMER_TEST_ID + '/tax_ids/' + TAX_ID_TEST_ID, + url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids/${TAX_ID_TEST_ID}`, data: {}, headers: {}, }); diff --git a/test/resources/TaxRates.spec.js b/test/resources/TaxRates.spec.js index 74e931b29b..65afc211b3 100644 --- a/test/resources/TaxRates.spec.js +++ b/test/resources/TaxRates.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('TaxRates Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('TaxRates Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.taxRates.retrieve('txr_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,9 +16,9 @@ describe('TaxRates Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { - var data = { + describe('update', () => { + it('Sends the correct request', () => { + const data = { metadata: {a: '1234'}, }; stripe.taxRates.update('txr_123', data); @@ -26,14 +26,14 @@ describe('TaxRates Resource', function() { method: 'POST', url: '/v1/tax_rates/txr_123', headers: {}, - data: data, + data, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { - var data = { + describe('create', () => { + it('Sends the correct request', () => { + const data = { display_name: 'name', inclusive: false, percentage: 10.15, @@ -44,13 +44,13 @@ describe('TaxRates Resource', function() { method: 'POST', url: '/v1/tax_rates', headers: {}, - data: data, + data, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.taxRates.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Terminal/ConnectionTokens.spec.js b/test/resources/Terminal/ConnectionTokens.spec.js index b0a58510ba..2fa3a23845 100644 --- a/test/resources/Terminal/ConnectionTokens.spec.js +++ b/test/resources/Terminal/ConnectionTokens.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Terminal', function() { - describe('ConnectionToken Resource', function () { - describe('create', function() { - it('Sends the correct request', function () { +describe('Terminal', () => { + describe('ConnectionToken Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { stripe.terminal.connectionTokens.create({}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', diff --git a/test/resources/Terminal/Locations.spec.js b/test/resources/Terminal/Locations.spec.js index bc6f7b41ae..9ed65d5f8b 100644 --- a/test/resources/Terminal/Locations.spec.js +++ b/test/resources/Terminal/Locations.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Terminal', function () { - describe('Locations Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Terminal', () => { + describe('Locations Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.terminal.locations.retrieve('loc_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Terminal', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.terminal.locations.create({ display_name: 'name', address: { @@ -49,8 +49,8 @@ describe('Terminal', function () { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.terminal.locations.del('loc_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -61,10 +61,10 @@ describe('Terminal', function () { }); }); - describe('update', function () { - it('Sends the correct request', function () { + describe('update', () => { + it('Sends the correct request', () => { stripe.terminal.locations.update('loc_123', { - display_name: 'name' + display_name: 'name', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -77,8 +77,8 @@ describe('Terminal', function () { }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.terminal.locations.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Terminal/Readers.spec.js b/test/resources/Terminal/Readers.spec.js index c3739c2b39..f4bd88fb90 100644 --- a/test/resources/Terminal/Readers.spec.js +++ b/test/resources/Terminal/Readers.spec.js @@ -1,13 +1,13 @@ 'use strict'; -var stripe = require('../../../testUtils').getSpyableStripe(); +const stripe = require('../../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const expect = require('chai').expect; -describe('Terminal', function () { - describe('Readers Resource', function () { - describe('retrieve', function () { - it('Sends the correct request', function () { +describe('Terminal', () => { + describe('Readers Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.terminal.readers.retrieve('rdr_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,8 +19,8 @@ describe('Terminal', function () { }); }); - describe('create', function () { - it('Sends the correct request', function () { + describe('create', () => { + it('Sends the correct request', () => { stripe.terminal.readers.create({ registration_code: 'a-b-c', label: 'name', @@ -37,8 +37,8 @@ describe('Terminal', function () { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.terminal.readers.del('rdr_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -49,10 +49,10 @@ describe('Terminal', function () { }); }); - describe('update', function () { - it('Sends the correct request', function () { + describe('update', () => { + it('Sends the correct request', () => { stripe.terminal.readers.update('rdr_123', { - label: 'name' + label: 'name', }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -65,8 +65,8 @@ describe('Terminal', function () { }); }); - describe('list', function () { - it('Sends the correct request', function () { + describe('list', () => { + it('Sends the correct request', () => { stripe.terminal.readers.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/ThreeDSecure.spec.js b/test/resources/ThreeDSecure.spec.js index 9efc67b1e6..7ff3aad648 100644 --- a/test/resources/ThreeDSecure.spec.js +++ b/test/resources/ThreeDSecure.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('ThreeDSecure Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('ThreeDSecure Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.threeDSecure.retrieve('tdsrc_id'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('ThreeDSecure Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.threeDSecure.create({ card: 'tok_test', amount: 1500, diff --git a/test/resources/Tokens.spec.js b/test/resources/Tokens.spec.js index 397168f002..a5dd59708a 100644 --- a/test/resources/Tokens.spec.js +++ b/test/resources/Tokens.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Tokens Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('Tokens Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { stripe.tokens.create({ card: {number: 123}, }); @@ -18,8 +18,8 @@ describe('Tokens Resource', function() { }); }); - describe('retrieve', function() { - it('Sends the correct request', function() { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.tokens.retrieve('tokenId1'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/Topups.spec.js b/test/resources/Topups.spec.js index 88db95651a..dc77c0d2d0 100644 --- a/test/resources/Topups.spec.js +++ b/test/resources/Topups.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Topup Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Topup Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.topups.retrieve('tu_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('Topup Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.topups.create({ source: 'src_123', amount: '1500', @@ -40,8 +40,8 @@ describe('Topup Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.topups.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -52,8 +52,8 @@ describe('Topup Resource', function() { }); }); - describe('cancel', function() { - it('Sends the correct request', function() { + describe('cancel', () => { + it('Sends the correct request', () => { stripe.topups.cancel('tu_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -64,14 +64,14 @@ describe('Topup Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { - stripe.topups.update('tu_123', {metadata: {'key': 'value'}}); + describe('update', () => { + it('Sends the correct request', () => { + stripe.topups.update('tu_123', {metadata: {key: 'value'}}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', url: '/v1/topups/tu_123', headers: {}, - data: {metadata: {'key': 'value'}}, + data: {metadata: {key: 'value'}}, }); }); }); diff --git a/test/resources/TransferReversals.spec.js b/test/resources/TransferReversals.spec.js index 19cb36f8a1..3b0c9e67fb 100644 --- a/test/resources/TransferReversals.spec.js +++ b/test/resources/TransferReversals.spec.js @@ -1,72 +1,70 @@ 'use strict'; -var resources = require('../../lib/stripe').resources; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const resources = require('../../lib/stripe').resources; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -var TRANSFER_TEST_ID = 'transferIdTest999'; -var REVERSAL_TEST_ID = 'reversalIdTest999'; +const TRANSFER_TEST_ID = 'transferIdTest999'; +const REVERSAL_TEST_ID = 'reversalIdTest999'; // Create new CustomerCard instance with pre-filled customerId: -var transferReversal = new resources.TransferReversals( - stripe, - {transferId: TRANSFER_TEST_ID} -); +const transferReversal = new resources.TransferReversals(stripe, { + transferId: TRANSFER_TEST_ID, +}); // Use spy from existing resource: transferReversal._request = stripe.customers._request; -describe('TransferReversal Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('TransferReversal Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { transferReversal.retrieve(REVERSAL_TEST_ID); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/transfers/' + TRANSFER_TEST_ID + '/reversals/' + REVERSAL_TEST_ID, + url: `/v1/transfers/${TRANSFER_TEST_ID}/reversals/${REVERSAL_TEST_ID}`, data: {}, headers: {}, }); }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { transferReversal.create({ amount: 100, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/transfers/' + TRANSFER_TEST_ID + '/reversals', + url: `/v1/transfers/${TRANSFER_TEST_ID}/reversals`, data: {amount: 100}, headers: {}, }); }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { transferReversal.update(REVERSAL_TEST_ID, { metadata: {key: 'value'}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', - url: '/v1/transfers/' + TRANSFER_TEST_ID + '/reversals/' + REVERSAL_TEST_ID, + url: `/v1/transfers/${TRANSFER_TEST_ID}/reversals/${REVERSAL_TEST_ID}`, data: {metadata: {key: 'value'}}, headers: {}, }); }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { transferReversal.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', - url: '/v1/transfers/' + TRANSFER_TEST_ID + '/reversals', + url: `/v1/transfers/${TRANSFER_TEST_ID}/reversals`, data: {}, headers: {}, }); }); }); }); - diff --git a/test/resources/Transfers.spec.js b/test/resources/Transfers.spec.js index 8fc6cdce71..bc369d8b4d 100644 --- a/test/resources/Transfers.spec.js +++ b/test/resources/Transfers.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('Transfers Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('Transfers Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.transfers.retrieve('transferId1'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,10 +16,12 @@ describe('Transfers Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.transfers.create({ - amount: 200, currency: 'usd', recipient: {}, + amount: 200, + currency: 'usd', + recipient: {}, }); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -30,8 +32,8 @@ describe('Transfers Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.transfers.update('transferId6654', { amount: 300, }); @@ -44,8 +46,8 @@ describe('Transfers Resource', function() { }); }); - describe('cancel', function() { - it('Sends the correct request', function() { + describe('cancel', () => { + it('Sends the correct request', () => { stripe.transfers.cancel('transferId4'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -56,8 +58,8 @@ describe('Transfers Resource', function() { }); }); - describe('reverse', function() { - it('Sends the correct request', function() { + describe('reverse', () => { + it('Sends the correct request', () => { stripe.transfers.reverse('transferId4'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'POST', @@ -68,8 +70,8 @@ describe('Transfers Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.transfers.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -80,8 +82,8 @@ describe('Transfers Resource', function() { }); }); - describe('listTransactions', function() { - it('Sends the correct request', function() { + describe('listTransactions', () => { + it('Sends the correct request', () => { stripe.transfers.listTransactions('tr_14222'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/resources/UsageRecordSummaries.spec.js b/test/resources/UsageRecordSummaries.spec.js index 7f9a1285a3..0661ca727d 100644 --- a/test/resources/UsageRecordSummaries.spec.js +++ b/test/resources/UsageRecordSummaries.spec.js @@ -1,40 +1,46 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('UsageRecordSummaries Resource', function() { - describe('list', function() { - it('Sends the correct request', function() { +describe('UsageRecordSummaries Resource', () => { + describe('list', () => { + it('Sends the correct request', () => { stripe.usageRecordSummaries.list('si_123', {}); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', url: '/v1/subscription_items/si_123/usage_record_summaries', headers: {}, - data: {} + data: {}, }); }); - it('Includes any options that were provided', function(done) { - stripe.usageRecordSummaries.list('si_123', {}, { - stripe_account: 'acct_456', - }).then(function(record) { - expect(stripe.LAST_REQUEST).to.deep.equal({ - method: 'GET', - url: '/v1/subscription_items/si_123/usage_record_summaries', - headers: { - 'Stripe-Account': 'acct_456' - }, - data: {} - }); + it('Includes any options that were provided', (done) => { + stripe.usageRecordSummaries + .list( + 'si_123', + {}, + { + stripe_account: 'acct_456', + } + ) + .then((record) => { + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/subscription_items/si_123/usage_record_summaries', + headers: { + 'Stripe-Account': 'acct_456', + }, + data: {}, + }); - done(); - }); + done(); + }); }); - it('Calls a given callback', function(done) { - stripe.usageRecordSummaries.list('si_123', {}, function(error, record) { + it('Calls a given callback', (done) => { + stripe.usageRecordSummaries.list('si_123', {}, (error, record) => { done(error); }); }); diff --git a/test/resources/UsageRecords.spec.js b/test/resources/UsageRecords.spec.js index 3dc29e4f71..fd9e3c7afc 100644 --- a/test/resources/UsageRecords.spec.js +++ b/test/resources/UsageRecords.spec.js @@ -1,15 +1,15 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('UsageRecords Resource', function() { - describe('create', function() { - it('Sends the correct request', function() { +describe('UsageRecords Resource', () => { + describe('create', () => { + it('Sends the correct request', () => { stripe.usageRecords.create('si_123', { quantity: 123, timestamp: 123321, - action: 'increment' + action: 'increment', }); expect(stripe.LAST_REQUEST).to.deep.equal({ @@ -19,44 +19,54 @@ describe('UsageRecords Resource', function() { data: { quantity: 123, timestamp: 123321, - action: 'increment' - } + action: 'increment', + }, }); }); - it('Includes any options that were provided', function(done) { - stripe.usageRecords.create('si_123', { - quantity: 123, - timestamp: 123321, - action: 'increment' - }, { - stripe_account: 'acct_456', - }).then(function(record) { - expect(stripe.LAST_REQUEST).to.deep.equal({ - method: 'POST', - url: '/v1/subscription_items/si_123/usage_records', - headers: { - 'Stripe-Account': 'acct_456' - }, - data: { + it('Includes any options that were provided', (done) => { + stripe.usageRecords + .create( + 'si_123', + { quantity: 123, timestamp: 123321, - action: 'increment' + action: 'increment', + }, + { + stripe_account: 'acct_456', } - }); + ) + .then((record) => { + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'POST', + url: '/v1/subscription_items/si_123/usage_records', + headers: { + 'Stripe-Account': 'acct_456', + }, + data: { + quantity: 123, + timestamp: 123321, + action: 'increment', + }, + }); - done(); - }); + done(); + }); }); - it('Calls a given callback', function(done) { - stripe.usageRecords.create('si_123', { - quantity: 123, - timestamp: 123321, - action: 'increment' - }, function(error, record) { - done(error); - }); + it('Calls a given callback', (done) => { + stripe.usageRecords.create( + 'si_123', + { + quantity: 123, + timestamp: 123321, + action: 'increment', + }, + (error, record) => { + done(error); + } + ); }); }); }); diff --git a/test/resources/WebhookEndpoints.spec.js b/test/resources/WebhookEndpoints.spec.js index a2ac60b390..4c76854402 100644 --- a/test/resources/WebhookEndpoints.spec.js +++ b/test/resources/WebhookEndpoints.spec.js @@ -1,11 +1,11 @@ 'use strict'; -var stripe = require('../../testUtils').getSpyableStripe(); -var expect = require('chai').expect; +const stripe = require('../../testUtils').getSpyableStripe(); +const expect = require('chai').expect; -describe('WebhookEndpoints Resource', function() { - describe('retrieve', function() { - it('Sends the correct request', function() { +describe('WebhookEndpoints Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { stripe.webhookEndpoints.retrieve('we_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', @@ -16,8 +16,8 @@ describe('WebhookEndpoints Resource', function() { }); }); - describe('del', function() { - it('Sends the correct request', function() { + describe('del', () => { + it('Sends the correct request', () => { stripe.webhookEndpoints.del('we_123'); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'DELETE', @@ -28,8 +28,8 @@ describe('WebhookEndpoints Resource', function() { }); }); - describe('update', function() { - it('Sends the correct request', function() { + describe('update', () => { + it('Sends the correct request', () => { stripe.webhookEndpoints.update('we_123', { enabled_events: ['charge.succeeded'], }); @@ -44,8 +44,8 @@ describe('WebhookEndpoints Resource', function() { }); }); - describe('create', function() { - it('Sends the correct request', function() { + describe('create', () => { + it('Sends the correct request', () => { stripe.webhookEndpoints.create({ enabled_events: ['charge.succeeded'], url: 'https://stripe.com', @@ -63,8 +63,8 @@ describe('WebhookEndpoints Resource', function() { }); }); - describe('list', function() { - it('Sends the correct request', function() { + describe('list', () => { + it('Sends the correct request', () => { stripe.webhookEndpoints.list(); expect(stripe.LAST_REQUEST).to.deep.equal({ method: 'GET', diff --git a/test/stripe.spec.js b/test/stripe.spec.js index 566cc93ba0..7304a9d3e5 100644 --- a/test/stripe.spec.js +++ b/test/stripe.spec.js @@ -1,128 +1,140 @@ 'use strict'; -var testUtils = require('../testUtils'); -var utils = require('../lib/utils'); -var stripe = require('../lib/stripe')( - testUtils.getUserStripeKey(), - 'latest' -); +const testUtils = require('../testUtils'); +const utils = require('../lib/utils'); +const stripe = require('../lib/stripe')(testUtils.getUserStripeKey(), 'latest'); -var http = require('http'); +const http = require('http'); -var expect = require('chai').expect; +const expect = require('chai').expect; -var CUSTOMER_DETAILS = { +const CUSTOMER_DETAILS = { description: 'Some customer', card: 'tok_visa', }; describe('Stripe Module', function() { - var cleanup = new testUtils.CleanupUtility(); + const cleanup = new testUtils.CleanupUtility(); this.timeout(20000); - describe('setApiKey', function() { - it('uses Bearer auth', function() { - expect(stripe.getApiField('auth')).to.equal('Bearer ' + testUtils.getUserStripeKey()); + describe('setApiKey', () => { + it('uses Bearer auth', () => { + expect(stripe.getApiField('auth')).to.equal( + `Bearer ${testUtils.getUserStripeKey()}` + ); }); }); - describe('GetClientUserAgent', function() { - it('Should return a user-agent serialized JSON object', function() { - return expect(new Promise(function(resolve, reject) { - stripe.getClientUserAgent(function(c) { - resolve(JSON.parse(c)); - }); - })).to.eventually.have.property('lang', 'node'); - }); + describe('GetClientUserAgent', () => { + it('Should return a user-agent serialized JSON object', () => + expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgent((c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('lang', 'node')); }); - describe('GetClientUserAgentSeeded', function() { - it('Should return a user-agent serialized JSON object', function() { - var userAgent = {lang: 'node'}; - return expect(new Promise(function(resolve, reject) { - stripe.getClientUserAgentSeeded(userAgent, function(c) { - resolve(JSON.parse(c)); - }); - })).to.eventually.have.property('lang', 'node'); + describe('GetClientUserAgentSeeded', () => { + it('Should return a user-agent serialized JSON object', () => { + const userAgent = {lang: 'node'}; + return expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgentSeeded(userAgent, (c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('lang', 'node'); }); - it('Should URI-encode user-agent fields', function() { - var userAgent = {lang: 'ï'}; - return expect(new Promise(function(resolve, reject) { - stripe.getClientUserAgentSeeded(userAgent, function(c) { - resolve(JSON.parse(c)); - }); - })).to.eventually.have.property('lang', '%C3%AF'); + it('Should URI-encode user-agent fields', () => { + const userAgent = {lang: 'ï'}; + return expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgentSeeded(userAgent, (c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('lang', '%C3%AF'); }); - describe('uname', function() { - var origExec; - beforeEach(function() { + describe('uname', () => { + let origExec; + beforeEach(() => { origExec = utils.safeExec; }); - afterEach(function() { + afterEach(() => { utils.safeExec = origExec; }); - it('gets added to the user-agent', function() { - utils.safeExec = function(cmd, cb) { - cb(null, 'foøname') + it('gets added to the user-agent', () => { + utils.safeExec = (cmd, cb) => { + cb(null, 'foøname'); }; - return expect(new Promise(function(resolve, reject) { - stripe.getClientUserAgentSeeded({lang: 'node'}, function(c) { - resolve(JSON.parse(c)); - }); - })).to.eventually.have.property('uname', 'fo%C3%B8name'); + return expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgentSeeded({lang: 'node'}, (c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('uname', 'fo%C3%B8name'); }); - it('sets uname to UNKOWN in case of an error', function() { - utils.safeExec = function(cmd, cb) { - cb(new Error('security'), null) + it('sets uname to UNKOWN in case of an error', () => { + utils.safeExec = (cmd, cb) => { + cb(new Error('security'), null); }; - return expect(new Promise(function(resolve, reject) { - stripe.getClientUserAgentSeeded({lang: 'node'}, function(c) { - resolve(JSON.parse(c)); - }); - })).to.eventually.have.property('uname', 'UNKNOWN'); + return expect( + new Promise((resolve, reject) => { + stripe.getClientUserAgentSeeded({lang: 'node'}, (c) => { + resolve(JSON.parse(c)); + }); + }) + ).to.eventually.have.property('uname', 'UNKNOWN'); }); }); }); - describe('setTimeout', function() { - it('Should define a default equal to the node default', function() { - expect(stripe.getApiField('timeout')).to.equal(http.createServer().timeout); + describe('setTimeout', () => { + it('Should define a default equal to the node default', () => { + expect(stripe.getApiField('timeout')).to.equal( + http.createServer().timeout + ); }); - it('Should allow me to set a custom timeout', function() { + it('Should allow me to set a custom timeout', () => { stripe.setTimeout(900); expect(stripe.getApiField('timeout')).to.equal(900); }); - it('Should allow me to set null, to reset to the default', function() { + it('Should allow me to set null, to reset to the default', () => { stripe.setTimeout(null); - expect(stripe.getApiField('timeout')).to.equal(http.createServer().timeout); + expect(stripe.getApiField('timeout')).to.equal( + http.createServer().timeout + ); }); }); - describe('setAppInfo', function() { - describe('when given nothing or an empty object', function() { - it('should unset stripe._appInfo', function() { + describe('setAppInfo', () => { + describe('when given nothing or an empty object', () => { + it('should unset stripe._appInfo', () => { stripe.setAppInfo(); expect(stripe._appInfo).to.be.undefined; }); }); - describe('when given an object with no `name`', function() { - it('should throw an error', function() { - expect(function() { + describe('when given an object with no `name`', () => { + it('should throw an error', () => { + expect(() => { stripe.setAppInfo({}); }).to.throw(/AppInfo.name is required/); - expect(function() { + expect(() => { stripe.setAppInfo({ version: '1.2.3', }); }).to.throw(/AppInfo.name is required/); - expect(function() { + expect(() => { stripe.setAppInfo({ cats: '42', }); @@ -130,8 +142,8 @@ describe('Stripe Module', function() { }); }); - describe('when given at least a `name`', function() { - it('should set name, partner ID, url, and version of stripe._appInfo', function() { + describe('when given at least a `name`', () => { + it('should set name, partner ID, url, and version of stripe._appInfo', () => { stripe.setAppInfo({ name: 'MyAwesomeApp', }); @@ -165,10 +177,9 @@ describe('Stripe Module', function() { name: 'MyAwesomeApp', partner_id: 'partner_1234', }); - }); - it('should ignore any invalid properties', function() { + it('should ignore any invalid properties', () => { stripe.setAppInfo({ name: 'MyAwesomeApp', partner_id: 'partner_1234', @@ -185,8 +196,8 @@ describe('Stripe Module', function() { }); }); - it('should be included in the ClientUserAgent and be added to the UserAgent String', function(done) { - var appInfo = { + it('should be included in the ClientUserAgent and be added to the UserAgent String', (done) => { + const appInfo = { name: testUtils.getRandomString(), version: '1.2.345', url: 'https://myawesomeapp.info', @@ -194,74 +205,85 @@ describe('Stripe Module', function() { stripe.setAppInfo(appInfo); - stripe.getClientUserAgent(function(uaString) { + stripe.getClientUserAgent((uaString) => { expect(JSON.parse(uaString).application).to.eql(appInfo); - expect(stripe.getAppInfoAsString()).to.eql(appInfo.name + '/' + appInfo.version + ' (' + appInfo.url + ')'); + expect(stripe.getAppInfoAsString()).to.eql( + `${appInfo.name}/${appInfo.version} (${appInfo.url})` + ); done(); }); }); }); - describe('Callback support', function() { - describe('Any given endpoint', function() { - it('Will call a callback if successful', function() { - return expect(new Promise(function(resolve, reject) { - stripe.customers.create(CUSTOMER_DETAILS, function(err, customer) { - cleanup.deleteCustomer(customer.id); - resolve('Called!'); - }); - })).to.eventually.equal('Called!'); - }); - - it('Will expose HTTP response object', function() { - return expect(new Promise(function(resolve, reject) { - stripe.customers.create(CUSTOMER_DETAILS, function(err, customer) { - cleanup.deleteCustomer(customer.id); - - var headers = customer.lastResponse.headers; - expect(headers).to.contain.keys('request-id'); - - expect(customer.lastResponse.requestId).to.match(/^req_/); - expect(customer.lastResponse.statusCode).to.equal(200); - - resolve('Called!'); - }); - })).to.eventually.equal('Called!'); - }); - - it('Given an error the callback will receive it', function() { - return expect(new Promise(function(resolve, reject) { - stripe.customers.createCard('nonExistentCustId', {card: {}}, function(err, customer) { - if (err) { - resolve('ErrorWasPassed'); - } else { - reject(new Error('NoErrorPassed')); - } - }); - })).to.eventually.become('ErrorWasPassed'); - }); + describe('Callback support', () => { + describe('Any given endpoint', () => { + it('Will call a callback if successful', () => + expect( + new Promise((resolve, reject) => { + stripe.customers.create(CUSTOMER_DETAILS, (err, customer) => { + cleanup.deleteCustomer(customer.id); + resolve('Called!'); + }); + }) + ).to.eventually.equal('Called!')); + + it('Will expose HTTP response object', () => + expect( + new Promise((resolve, reject) => { + stripe.customers.create(CUSTOMER_DETAILS, (err, customer) => { + cleanup.deleteCustomer(customer.id); + + const headers = customer.lastResponse.headers; + expect(headers).to.contain.keys('request-id'); + + expect(customer.lastResponse.requestId).to.match(/^req_/); + expect(customer.lastResponse.statusCode).to.equal(200); + + resolve('Called!'); + }); + }) + ).to.eventually.equal('Called!')); + + it('Given an error the callback will receive it', () => + expect( + new Promise((resolve, reject) => { + stripe.customers.createCard( + 'nonExistentCustId', + {card: {}}, + (err, customer) => { + if (err) { + resolve('ErrorWasPassed'); + } else { + reject(new Error('NoErrorPassed')); + } + } + ); + }) + ).to.eventually.become('ErrorWasPassed')); }); }); - describe('errors', function() { - it('Exports errors as types', function() { - var Stripe = require('../lib/stripe'); - expect(new Stripe.errors.StripeInvalidRequestError({ - message: 'error' - }).type).to.equal('StripeInvalidRequestError'); + describe('errors', () => { + it('Exports errors as types', () => { + const Stripe = require('../lib/stripe'); + expect( + new Stripe.errors.StripeInvalidRequestError({ + message: 'error', + }).type + ).to.equal('StripeInvalidRequestError'); }); }); - describe('setMaxNetworkRetries', function() { - describe('when given an empty or non-number variable', function() { - it('should error', function() { - expect(function() { + describe('setMaxNetworkRetries', () => { + describe('when given an empty or non-number variable', () => { + it('should error', () => { + expect(() => { stripe.setMaxNetworkRetries('foo'); }).to.throw(/maxNetworkRetries must be a number/); - expect(function() { + expect(() => { stripe.setMaxNetworkRetries(); }).to.throw(/maxNetworkRetries must be a number/); }); diff --git a/test/telemetry.spec.js b/test/telemetry.spec.js index 845d51770a..355ec61de5 100644 --- a/test/telemetry.spec.js +++ b/test/telemetry.spec.js @@ -1,151 +1,171 @@ 'use strict'; require('../testUtils'); -var http = require('http'); +const http = require('http'); -var expect = require('chai').expect; -var testServer = null; +const expect = require('chai').expect; +let testServer = null; function createTestServer(handlerFunc, cb) { - var host = '127.0.0.1'; - testServer = http.createServer(function(req, res) { + const host = '127.0.0.1'; + testServer = http.createServer((req, res) => { try { handlerFunc(req, res); } catch (e) { res.writeHead(400, {'Content-Type': 'application/json'}); - res.end(JSON.stringify({ - error: {type: 'invalid_request_error', message: e.message} - })); + res.end( + JSON.stringify({ + error: {type: 'invalid_request_error', message: e.message}, + }) + ); } }); - testServer.listen(0, host, function() { - var port = testServer.address().port; + testServer.listen(0, host, () => { + const port = testServer.address().port; cb(host, port); }); } -describe('Client Telemetry', function() { - afterEach(function() { +describe('Client Telemetry', () => { + afterEach(() => { if (testServer) { testServer.close(); testServer = null; } }); - it('Does not send telemetry when disabled', function(done) { - var numRequests = 0; - - createTestServer(function (req, res) { - numRequests += 1; - - var telemetry = req.headers['x-stripe-client-telemetry']; - - switch (numRequests) { - case 1: - case 2: - expect(telemetry).to.not.exist; - break; - default: - expect.fail(`Should not have reached request ${numRequests}`); + it('Does not send telemetry when disabled', (done) => { + let numRequests = 0; + + createTestServer( + (req, res) => { + numRequests += 1; + + const telemetry = req.headers['x-stripe-client-telemetry']; + + switch (numRequests) { + case 1: + case 2: + expect(telemetry).to.not.exist; + break; + default: + expect.fail(`Should not have reached request ${numRequests}`); + } + + res.setHeader('Request-Id', `req_${numRequests}`); + res.writeHead(200, {'Content-Type': 'application/json'}); + res.end('{}'); + }, + (host, port) => { + const stripe = require('../lib/stripe')( + 'sk_test_FEiILxKZwnmmocJDUjUNO6pa' + ); + stripe.setHost(host, port, 'http'); + + stripe.balance + .retrieve() + .then((res) => stripe.balance.retrieve()) + .then((res) => { + expect(numRequests).to.equal(2); + done(); + }) + .catch(done); } - - res.setHeader('Request-Id', `req_${numRequests}`); - res.writeHead(200, {'Content-Type': 'application/json'}); - res.end('{}'); - }, function(host, port) { - const stripe = require('../lib/stripe')('sk_test_FEiILxKZwnmmocJDUjUNO6pa') - stripe.setHost(host, port, 'http'); - - stripe.balance.retrieve().then(function (res) { - return stripe.balance.retrieve(); - }).then(function (res) { - expect(numRequests).to.equal(2); - done(); - }).catch(done); - }); + ); }); - it('Sends client telemetry on the second request when enabled', function(done) { - var numRequests = 0; - - createTestServer(function (req, res) { - numRequests += 1; - - var telemetry = req.headers['x-stripe-client-telemetry']; - - switch (numRequests) { - case 1: - expect(telemetry).to.not.exist; - break; - case 2: - expect(telemetry).to.exist; - expect(JSON.parse(telemetry).last_request_metrics.request_id) - .to.equal('req_1'); - break; - default: - expect.fail(`Should not have reached request ${numRequests}`); + it('Sends client telemetry on the second request when enabled', (done) => { + let numRequests = 0; + + createTestServer( + (req, res) => { + numRequests += 1; + + const telemetry = req.headers['x-stripe-client-telemetry']; + + switch (numRequests) { + case 1: + expect(telemetry).to.not.exist; + break; + case 2: + expect(telemetry).to.exist; + expect( + JSON.parse(telemetry).last_request_metrics.request_id + ).to.equal('req_1'); + break; + default: + expect.fail(`Should not have reached request ${numRequests}`); + } + + res.setHeader('Request-Id', `req_${numRequests}`); + res.writeHead(200, {'Content-Type': 'application/json'}); + res.end('{}'); + }, + (host, port) => { + const stripe = require('../lib/stripe')( + 'sk_test_FEiILxKZwnmmocJDUjUNO6pa' + ); + stripe.setTelemetryEnabled(true); + stripe.setHost(host, port, 'http'); + + stripe.balance + .retrieve() + .then((res) => stripe.balance.retrieve()) + .then((res) => { + expect(numRequests).to.equal(2); + done(); + }) + .catch(done); } - - res.setHeader('Request-Id', `req_${numRequests}`); - res.writeHead(200, {'Content-Type': 'application/json'}); - res.end('{}'); - }, function(host, port) { - const stripe = require('../lib/stripe')('sk_test_FEiILxKZwnmmocJDUjUNO6pa') - stripe.setTelemetryEnabled(true); - stripe.setHost(host, port, 'http'); - - stripe.balance.retrieve().then(function (res) { - return stripe.balance.retrieve(); - }).then(function (res) { - expect(numRequests).to.equal(2); - done(); - }).catch(done); - }); + ); }); - it('Buffers metrics on concurrent requests', function(done) { - var numRequests = 0; - - createTestServer(function (req, res) { - numRequests += 1; - - var telemetry = req.headers['x-stripe-client-telemetry']; - - switch (numRequests) { - case 1: - case 2: - expect(telemetry).to.not.exist; - break; - case 3: - case 4: - expect(telemetry).to.exist; - expect(JSON.parse(telemetry).last_request_metrics.request_id) - .to.be.oneOf(['req_1', 'req_2']); - break; - default: - expect.fail(`Should not have reached request ${numRequests}`); + it('Buffers metrics on concurrent requests', (done) => { + let numRequests = 0; + + createTestServer( + (req, res) => { + numRequests += 1; + + const telemetry = req.headers['x-stripe-client-telemetry']; + + switch (numRequests) { + case 1: + case 2: + expect(telemetry).to.not.exist; + break; + case 3: + case 4: + expect(telemetry).to.exist; + expect( + JSON.parse(telemetry).last_request_metrics.request_id + ).to.be.oneOf(['req_1', 'req_2']); + break; + default: + expect.fail(`Should not have reached request ${numRequests}`); + } + + res.setHeader('Request-Id', `req_${numRequests}`); + res.writeHead(200, {'Content-Type': 'application/json'}); + res.end('{}'); + }, + (host, port) => { + const stripe = require('../lib/stripe')( + 'sk_test_FEiILxKZwnmmocJDUjUNO6pa' + ); + stripe.setTelemetryEnabled(true); + stripe.setHost(host, port, 'http'); + + Promise.all([stripe.balance.retrieve(), stripe.balance.retrieve()]) + .then(() => + Promise.all([stripe.balance.retrieve(), stripe.balance.retrieve()]) + ) + .then(() => { + expect(numRequests).to.equal(4); + done(); + }) + .catch(done); } - - res.setHeader('Request-Id', `req_${numRequests}`); - res.writeHead(200, {'Content-Type': 'application/json'}); - res.end('{}'); - }, function(host, port) { - const stripe = require('../lib/stripe')('sk_test_FEiILxKZwnmmocJDUjUNO6pa') - stripe.setTelemetryEnabled(true); - stripe.setHost(host, port, 'http'); - - Promise.all([ - stripe.balance.retrieve(), - stripe.balance.retrieve() - ]).then(function() { - return Promise.all([ - stripe.balance.retrieve(), - stripe.balance.retrieve() - ]); - }).then(function() { - expect(numRequests).to.equal(4); - done(); - }).catch(done); - }); + ); }); }); diff --git a/test/utils.spec.js b/test/utils.spec.js index f406535825..202da2f67c 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -2,22 +2,18 @@ require('../testUtils'); -var utils = require('../lib/utils'); -var expect = require('chai').expect; -var Buffer = require('safe-buffer').Buffer; +const utils = require('../lib/utils'); +const expect = require('chai').expect; +const Buffer = require('safe-buffer').Buffer; -describe('utils', function() { - describe('makeURLInterpolator', function() { - it('Interpolates values into a prepared template', function() { - var template = utils.makeURLInterpolator('/some/url/{foo}/{baz}?ok=1'); +describe('utils', () => { + describe('makeURLInterpolator', () => { + it('Interpolates values into a prepared template', () => { + const template = utils.makeURLInterpolator('/some/url/{foo}/{baz}?ok=1'); - expect( - template({foo: 1, baz: 2}) - ).to.equal('/some/url/1/2?ok=1'); + expect(template({foo: 1, baz: 2})).to.equal('/some/url/1/2?ok=1'); - expect( - template({foo: '', baz: ''}) - ).to.equal('/some/url//?ok=1'); + expect(template({foo: '', baz: ''})).to.equal('/some/url//?ok=1'); expect( // Test encoding: @@ -26,82 +22,95 @@ describe('utils', function() { }); }); - describe('stringifyRequestData', function() { - it('Handles basic types', function() { - expect(utils.stringifyRequestData({ - a: 1, - b: 'foo', - })).to.equal('a=1&b=foo'); + describe('stringifyRequestData', () => { + it('Handles basic types', () => { + expect( + utils.stringifyRequestData({ + a: 1, + b: 'foo', + }) + ).to.equal('a=1&b=foo'); }); - it('Handles Dates', function() { - expect(utils.stringifyRequestData({ - date: new Date('2009-02-13T23:31:30Z'), - created: { - gte: new Date('2009-02-13T23:31:30Z'), - lt: new Date('2044-05-01T01:28:21Z'), - }, - })).to.equal([ - 'date=1234567890', - 'created[gte]=1234567890', - 'created[lt]=2345678901' - ].join('&')); - }); - - it('Handles deeply nested object', function() { - expect(utils.stringifyRequestData({ - a: { - b: { - c: { - d: 2, + it('Handles Dates', () => { + expect( + utils.stringifyRequestData({ + date: new Date('2009-02-13T23:31:30Z'), + created: { + gte: new Date('2009-02-13T23:31:30Z'), + lt: new Date('2044-05-01T01:28:21Z'), + }, + }) + ).to.equal( + [ + 'date=1234567890', + 'created[gte]=1234567890', + 'created[lt]=2345678901', + ].join('&') + ); + }); + + it('Handles deeply nested object', () => { + expect( + utils.stringifyRequestData({ + a: { + b: { + c: { + d: 2, + }, }, }, - }, - })).to.equal('a[b][c][d]=2'); - }); - - it('Handles arrays of objects', function() { - expect(utils.stringifyRequestData({ - a: [ - {b: 'c'}, - {b: 'd'}, - ], - })).to.equal('a[0][b]=c&a[1][b]=d'); - }) - - it('Handles indexed arrays', function() { - expect(utils.stringifyRequestData({ - a: { - 0: {b: 'c'}, - 1: {b: 'd'}, - }, - })).to.equal('a[0][b]=c&a[1][b]=d'); - }) - - it('Creates a string from an object, handling shallow nested objects', function() { - expect(utils.stringifyRequestData({ - test: 1, - foo: 'baz', - somethingElse: '::""%&', - nested: { - 1: 2, - 'a n o t h e r': null, - }, - })).to.equal([ - 'test=1', - 'foo=baz', - 'somethingElse=%3A%3A%22%22%25%26', - 'nested[1]=2', - 'nested[a%20n%20o%20t%20h%20e%20r]=', - ].join('&')); + }) + ).to.equal('a[b][c][d]=2'); + }); + + it('Handles arrays of objects', () => { + expect( + utils.stringifyRequestData({ + a: [{b: 'c'}, {b: 'd'}], + }) + ).to.equal('a[0][b]=c&a[1][b]=d'); + }); + + it('Handles indexed arrays', () => { + expect( + utils.stringifyRequestData({ + a: { + 0: {b: 'c'}, + 1: {b: 'd'}, + }, + }) + ).to.equal('a[0][b]=c&a[1][b]=d'); + }); + + it('Creates a string from an object, handling shallow nested objects', () => { + expect( + utils.stringifyRequestData({ + test: 1, + foo: 'baz', + somethingElse: '::""%&', + nested: { + 1: 2, + 'a n o t h e r': null, + }, + }) + ).to.equal( + [ + 'test=1', + 'foo=baz', + 'somethingElse=%3A%3A%22%22%25%26', + 'nested[1]=2', + 'nested[a%20n%20o%20t%20h%20e%20r]=', + ].join('&') + ); }); }); - describe('protoExtend', function() { - it('Provides an extension mechanism', function() { + describe('protoExtend', () => { + it('Provides an extension mechanism', () => { function A() {} A.extend = utils.protoExtend; - var B = A.extend({ + const B = A.extend({ constructor: function() { this.called = true; }, @@ -113,101 +122,110 @@ describe('utils', function() { }); }); - describe('getDataFromArgs', function() { - it('handles an empty list', function() { + describe('getDataFromArgs', () => { + it('handles an empty list', () => { expect(utils.getDataFromArgs([])).to.deep.equal({}); }); - it('handles a list with no object', function() { - var args = [1, 3]; + it('handles a list with no object', () => { + const args = [1, 3]; expect(utils.getDataFromArgs(args)).to.deep.equal({}); expect(args.length).to.equal(2); }); - it('ignores a hash with only options', function(done) { - var args = [{api_key: 'foo'}]; + it('ignores a hash with only options', (done) => { + const args = [{api_key: 'foo'}]; - handleWarnings(function() { - expect(utils.getDataFromArgs(args)).to.deep.equal({}); - expect(args.length).to.equal(1); + handleWarnings( + () => { + expect(utils.getDataFromArgs(args)).to.deep.equal({}); + expect(args.length).to.equal(1); - done(); - }, function(message) { - throw new Error('Should not have warned, but did: ' + message); - }); + done(); + }, + (message) => { + throw new Error(`Should not have warned, but did: ${message}`); + } + ); }); - it('warns if the hash contains both data and options', function(done) { - var args = [{foo: 'bar', api_key: 'foo', idempotency_key: 'baz'}]; - - handleWarnings(function() { - utils.getDataFromArgs(args); - }, function(message) { - expect(message).to.equal( - 'Stripe: Options found in arguments (api_key, idempotency_key).' + - ' Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.' - ); + it('warns if the hash contains both data and options', (done) => { + const args = [{foo: 'bar', api_key: 'foo', idempotency_key: 'baz'}]; - done(); - }); - }); - it('finds the data', function() { - var args = [{foo: 'bar'}, {api_key: 'foo'}]; + handleWarnings( + () => { + utils.getDataFromArgs(args); + }, + (message) => { + expect(message).to.equal( + 'Stripe: Options found in arguments (api_key, idempotency_key).' + + ' Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.' + ); + + done(); + } + ); + }); + it('finds the data', () => { + const args = [{foo: 'bar'}, {api_key: 'foo'}]; expect(utils.getDataFromArgs(args)).to.deep.equal({foo: 'bar'}); expect(args.length).to.equal(1); }); }); - describe('getOptsFromArgs', function() { - it('handles an empty list', function() { + describe('getOptsFromArgs', () => { + it('handles an empty list', () => { expect(utils.getOptionsFromArgs([])).to.deep.equal({ auth: null, headers: {}, }); }); - it('handles an list with no object', function() { - var args = [1, 3]; + it('handles an list with no object', () => { + const args = [1, 3]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: null, headers: {}, }); expect(args.length).to.equal(2); }); - it('ignores a non-options object', function() { - var args = [{foo: 'bar'}]; + it('ignores a non-options object', () => { + const args = [{foo: 'bar'}]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: null, headers: {}, }); expect(args.length).to.equal(1); }); - it('parses an api key', function() { - var args = ['sk_test_iiiiiiiiiiiiiiiiiiiiiiii']; + it('parses an api key', () => { + const args = ['sk_test_iiiiiiiiiiiiiiiiiiiiiiii']; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', headers: {}, }); expect(args.length).to.equal(0); }); - it('parses an idempotency key', function() { - var args = [{foo: 'bar'}, {idempotency_key: 'foo'}]; + it('parses an idempotency key', () => { + const args = [{foo: 'bar'}, {idempotency_key: 'foo'}]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: null, headers: {'Idempotency-Key': 'foo'}, }); expect(args.length).to.equal(1); }); - it('parses an api version', function() { - var args = [{foo: 'bar'}, {stripe_version: '2003-03-30'}]; + it('parses an api version', () => { + const args = [{foo: 'bar'}, {stripe_version: '2003-03-30'}]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: null, headers: {'Stripe-Version': '2003-03-30'}, }); expect(args.length).to.equal(1); }); - it('parses an idempotency key and api key and api version (with data)', function() { - var args = [{foo: 'bar'}, { - api_key: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', - idempotency_key: 'foo', - stripe_version: '2010-01-10', - },]; + it('parses an idempotency key and api key and api version (with data)', () => { + const args = [ + {foo: 'bar'}, + { + api_key: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', + idempotency_key: 'foo', + stripe_version: '2010-01-10', + }, + ]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', headers: { @@ -217,12 +235,14 @@ describe('utils', function() { }); expect(args.length).to.equal(1); }); - it('parses an idempotency key and api key and api version', function() { - var args = [{ - api_key: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', - idempotency_key: 'foo', - stripe_version: 'hunter2', - },]; + it('parses an idempotency key and api key and api version', () => { + const args = [ + { + api_key: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', + idempotency_key: 'foo', + stripe_version: 'hunter2', + }, + ]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ auth: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', headers: { @@ -232,148 +252,160 @@ describe('utils', function() { }); expect(args.length).to.equal(0); }); - it('warns if the hash contains something that does not belong', function(done) { - var args = [{foo: 'bar'}, { - api_key: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', - idempotency_key: 'foo', - stripe_version: '2010-01-10', - fishsticks: true, - custard: true, - },]; - - handleWarnings(function() { - utils.getOptionsFromArgs(args); - }, function(message) { - expect(message).to.equal( - 'Stripe: Invalid options found (fishsticks, custard); ignoring.' - ); - - done(); - }); + it('warns if the hash contains something that does not belong', (done) => { + const args = [ + {foo: 'bar'}, + { + api_key: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', + idempotency_key: 'foo', + stripe_version: '2010-01-10', + fishsticks: true, + custard: true, + }, + ]; + + handleWarnings( + () => { + utils.getOptionsFromArgs(args); + }, + (message) => { + expect(message).to.equal( + 'Stripe: Invalid options found (fishsticks, custard); ignoring.' + ); + + done(); + } + ); }); }); - describe('secureCompare', function() { - it('returns true given two equal things', function() { + describe('secureCompare', () => { + it('returns true given two equal things', () => { expect(utils.secureCompare('potato', 'potato')).to.equal(true); }); - it('returns false given two unequal things', function() { + it('returns false given two unequal things', () => { expect(utils.secureCompare('potato', 'tomato')).to.equal(false); }); - it('throws an error if not given two things to compare', function() { - expect(function() { utils.secureCompare('potato'); }).to.throw(); + it('throws an error if not given two things to compare', () => { + expect(() => { + utils.secureCompare('potato'); + }).to.throw(); }); }); - describe('removeEmpty', function() { - it('removes empty properties and leaves non-empty ones', function() { - expect(utils.removeEmpty({ - cat: 3, - dog: false, - rabbit: undefined, - pointer: null, - })).to.eql({ + describe('removeEmpty', () => { + it('removes empty properties and leaves non-empty ones', () => { + expect( + utils.removeEmpty({ + cat: 3, + dog: false, + rabbit: undefined, + pointer: null, + }) + ).to.eql({ cat: 3, dog: false, }); }); - it('throws an error if not given two things to compare', function() { - expect(function() { utils.removeEmpty('potato'); }).to.throw(); + it('throws an error if not given two things to compare', () => { + expect(() => { + utils.removeEmpty('potato'); + }).to.throw(); }); }); - describe('safeExec', function() { - var origExec; - beforeEach(function() { + describe('safeExec', () => { + let origExec; + beforeEach(() => { origExec = utils._exec; }); - afterEach(function() { + afterEach(() => { utils._exec = origExec; }); - it('runs exec', function() { - var calls = []; - utils._exec = function(cmd, cb) { + it('runs exec', () => { + const calls = []; + utils._exec = (cmd, cb) => { calls.push([cmd, cb]); - } + }; function myCb() {} utils.safeExec('hello', myCb); - expect(calls).to.deep.equal([ - ['hello', myCb], - ]); + expect(calls).to.deep.equal([['hello', myCb]]); }); - it('passes along normal errors', function() { - var myErr = Error('hi'); - utils._exec = function(cmd, cb) { - cb(myErr, null) - } + it('passes along normal errors', () => { + const myErr = Error('hi'); + utils._exec = (cmd, cb) => { + cb(myErr, null); + }; - var calls = []; + const calls = []; function myCb(err, x) { calls.push([err, x]); } utils.safeExec('hello', myCb); - expect(calls).to.deep.equal([ - [myErr, null], - ]); + expect(calls).to.deep.equal([[myErr, null]]); }); - it('passes along thrown errors as normal callback errors', function() { - var myErr = Error('hi'); - utils._exec = function(cmd, cb) { + it('passes along thrown errors as normal callback errors', () => { + const myErr = Error('hi'); + utils._exec = (cmd, cb) => { throw myErr; - } + }; - var calls = []; + const calls = []; function myCb(err, x) { calls.push([err, x]); } utils.safeExec('hello', myCb); - expect(calls).to.deep.equal([ - [myErr, null], - ]); - }); - }) - - describe('flattenAndStringify', function() { - it('Stringifies primitive types', function() { - expect(utils.flattenAndStringify({ - a: 1, - b: 'foo', - c: true, - d: null, - })).to.eql({'a': '1', 'b': 'foo', 'c': 'true', 'd': 'null'}); + expect(calls).to.deep.equal([[myErr, null]]); }); + }); - it('Flattens nested values', function() { - expect(utils.flattenAndStringify({ - x: { + describe('flattenAndStringify', () => { + it('Stringifies primitive types', () => { + expect( + utils.flattenAndStringify({ a: 1, b: 'foo', - }, - })).to.eql({'x[a]': '1', 'x[b]': 'foo'}); + c: true, + d: null, + }) + ).to.eql({a: '1', b: 'foo', c: 'true', d: 'null'}); }); - it('Does not flatten File objects', function() { - expect(utils.flattenAndStringify({ - file: { - data: 'foo' - }, - x: { - a: 1, - }, - })).to.eql({'file': {data: 'foo'}, 'x[a]': '1'}); + it('Flattens nested values', () => { + expect( + utils.flattenAndStringify({ + x: { + a: 1, + b: 'foo', + }, + }) + ).to.eql({'x[a]': '1', 'x[b]': 'foo'}); }); - it('Does not flatten Buffer objects', function() { - var buf = Buffer.from('Hi!'); - var flattened = utils.flattenAndStringify({ - buf: buf, + it('Does not flatten File objects', () => { + expect( + utils.flattenAndStringify({ + file: { + data: 'foo', + }, + x: { + a: 1, + }, + }) + ).to.eql({file: {data: 'foo'}, 'x[a]': '1'}); + }); + + it('Does not flatten Buffer objects', () => { + const buf = Buffer.from('Hi!'); + const flattened = utils.flattenAndStringify({ + buf, x: { a: 1, }, @@ -391,7 +423,7 @@ function handleWarnings(doWithShimmedConsoleWarn, onWarn) { /* eslint-disable no-console */ // Shim `console.warn` - var _warn = console.warn; + const _warn = console.warn; console.warn = onWarn; doWithShimmedConsoleWarn(); @@ -401,16 +433,17 @@ function handleWarnings(doWithShimmedConsoleWarn, onWarn) { /* eslint-enable no-console */ } else { - function onProcessWarn(warning) { /* eslint-disable-line no-inner-declarations */ - onWarn(warning.name + ': ' + warning.message); + /* eslint-disable-next-line no-inner-declarations */ + function onProcessWarn(warning) { + onWarn(`${warning.name}: ${warning.message}`); } process.on('warning', onProcessWarn); doWithShimmedConsoleWarn(); - process.nextTick(function() { + process.nextTick(() => { process.removeListener('warning', onProcessWarn); - }) + }); } } diff --git a/testUtils/index.js b/testUtils/index.js index 9d885ff456..8215645e53 100644 --- a/testUtils/index.js +++ b/testUtils/index.js @@ -6,26 +6,26 @@ require('mocha'); // Ensure we are using the 'as promised' libs before any tests are run: require('chai').use(require('chai-as-promised')); -var ResourceNamespace = require('../lib/ResourceNamespace').ResourceNamespace; +const ResourceNamespace = require('../lib/ResourceNamespace').ResourceNamespace; -var utils = module.exports = { - - getUserStripeKey: function() { - var key = process.env.STRIPE_TEST_API_KEY || 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I'; +const utils = (module.exports = { + getUserStripeKey: () => { + const key = + process.env.STRIPE_TEST_API_KEY || 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I'; return key; }, - getSpyableStripe: function() { + getSpyableStripe: () => { // Provide a testable stripe instance // That is, with mock-requests built in and hookable - var stripe = require('../lib/stripe'); - var stripeInstance = stripe('fakeAuthToken'); + const stripe = require('../lib/stripe'); + const stripeInstance = stripe('fakeAuthToken'); stripeInstance.REQUESTS = []; - for (var i in stripeInstance) { + for (const i in stripeInstance) { makeInstanceSpyable(stripeInstance, stripeInstance[i]); } @@ -33,9 +33,9 @@ var utils = module.exports = { if (thisInstance instanceof stripe.StripeResource) { patchRequest(stripeInstance, thisInstance); } else if (thisInstance instanceof ResourceNamespace) { - var namespace = thisInstance; + const namespace = thisInstance; - for (var j in namespace) { + for (const j in namespace) { makeInstanceSpyable(stripeInstance, namespace[j]); } } @@ -43,12 +43,12 @@ var utils = module.exports = { function patchRequest(stripeInstance, instance) { instance._request = function(method, host, url, data, auth, options, cb) { - var req = stripeInstance.LAST_REQUEST = { - method: method, - url: url, - data: data, + const req = (stripeInstance.LAST_REQUEST = { + method, + url, + data, headers: options.headers || {}, - }; + }); if (auth) { req.auth = auth; } @@ -68,11 +68,11 @@ var utils = module.exports = { * CleanupUtility will automatically register on the mocha afterEach hook, * ensuring its called after each descendent-describe block. */ - CleanupUtility: (function() { + CleanupUtility: (() => { CleanupUtility.DEFAULT_TIMEOUT = 20000; function CleanupUtility(timeout) { - var self = this; + const self = this; this._cleanupFns = []; this._stripe = require('../lib/stripe')( utils.getUserStripeKey(), @@ -85,50 +85,55 @@ var utils = module.exports = { } CleanupUtility.prototype = { - - doCleanup: function(done) { - var cleanups = this._cleanupFns; - var total = cleanups.length; - var completed = 0; - for (var fn; (fn = cleanups.shift());) { - var promise = fn.call(this); + doCleanup(done) { + const cleanups = this._cleanupFns; + const total = cleanups.length; + let completed = 0; + let fn; + while ((fn = cleanups.shift())) { + const promise = fn.call(this); if (!promise || !promise.then) { - throw new Error('CleanupUtility expects cleanup functions to return promises!'); + throw new Error( + 'CleanupUtility expects cleanup functions to return promises!' + ); } - promise.then(function() { - // cleanup successful - completed += 1; - if (completed === total) { - done(); + promise.then( + () => { + // cleanup successful + completed += 1; + if (completed === total) { + done(); + } + }, + (err) => { + // not successful + throw err; } - }, function(err) { - // not successful - throw err; - }); + ); } if (total === 0) { done(); } }, - add: function(fn) { + add(fn) { this._cleanupFns.push(fn); }, - deleteCustomer: function(custId) { + deleteCustomer(custId) { this.add(function() { return this._stripe.customers.del(custId); }); }, - deletePlan: function(pId) { + deletePlan(pId) { this.add(function() { return this._stripe.plans.del(pId); }); }, - deleteCoupon: function(cId) { + deleteCoupon(cId) { this.add(function() { return this._stripe.coupons.del(cId); }); }, - deleteInvoiceItem: function(iiId) { + deleteInvoiceItem(iiId) { this.add(function() { return this._stripe.invoiceItems.del(iiId); }); @@ -136,20 +141,22 @@ var utils = module.exports = { }; return CleanupUtility; - }()), + })(), /** - * Get a random string for test Object creation - */ - getRandomString: function() { - return Math.random().toString(36).slice(2); + * Get a random string for test Object creation + */ + getRandomString: () => { + return Math.random() + .toString(36) + .slice(2); }, - envSupportsForAwait: function() { + envSupportsForAwait: () => { return typeof Symbol !== 'undefined' && Symbol.asyncIterator; }, - envSupportsAwait: function() { + envSupportsAwait: () => { try { eval('(async function() {})'); // eslint-disable-line no-eval return true; @@ -157,5 +164,4 @@ var utils = module.exports = { return false; } }, - -}; +}); diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000000..a4902128f6 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,3144 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/generator@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.4.tgz#174a215eb843fc392c7edcaabeaa873de6e8f041" + integrity sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ== + dependencies: + "@babel/types" "^7.4.4" + jsesc "^2.5.1" + lodash "^4.17.11" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-function-name@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" + integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== + dependencies: + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.0.0", "@babel/parser@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.4.tgz#5977129431b8fe33471730d255ce8654ae1250b6" + integrity sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w== + +"@babel/template@^7.1.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" + integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/traverse@^7.0.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.4.tgz#0776f038f6d78361860b6823887d4f3937133fe8" + integrity sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.4.4" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.11" + +"@babel/types@^7.0.0", "@babel/types@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" + integrity sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ== + dependencies: + esutils "^2.0.2" + lodash "^4.17.11" + to-fast-properties "^2.0.0" + +acorn-jsx@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" + integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== + +acorn@^6.0.7: + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" + integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== + +ajv@^6.5.5, ajv@^6.9.1: + version "6.10.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" + integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-escapes@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + integrity sha1-126/jKlNJ24keja61EpLdKthGZE= + dependencies: + default-require-extensions "^1.0.0" + +archy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= + dependencies: + arr-flatten "^1.0.1" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.0.1, arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +assertion-error@^1.0.1, assertion-error@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-eslint@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" + integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + eslint-scope "3.7.1" + eslint-visitor-keys "^1.0.0" + +babel-generator@^6.18.0: + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + integrity sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA== + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.7" + trim-right "^1.0.1" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + dependencies: + babel-runtime "^6.22.0" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.16.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.18.0, babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.18.0, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +caching-transform@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1" + integrity sha1-bb2y8g+Nj7znnz6U6dF0Lc31wKE= + dependencies: + md5-hex "^1.2.0" + mkdirp "^0.5.1" + write-file-atomic "^1.1.4" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +chai-as-promised@~7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0" + integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA== + dependencies: + check-error "^1.0.2" + +chai@^4.1.2: + version "4.2.0" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.2.0.tgz#760aa72cf20e3795e84b12877ce0e83737aa29e5" + integrity sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw== + dependencies: + assertion-error "^1.1.0" + check-error "^1.0.2" + deep-eql "^3.0.1" + get-func-name "^2.0.0" + pathval "^1.1.0" + type-detect "^4.0.5" + +chai@~4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c" + integrity sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw= + dependencies: + assertion-error "^1.0.1" + check-error "^1.0.1" + deep-eql "^3.0.0" + get-func-name "^2.0.0" + pathval "^1.0.0" + type-detect "^4.0.0" + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + +check-error@^1.0.1, check-error@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" + integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +cliui@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + wrap-ansi "^2.0.0" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" + integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w== + dependencies: + delayed-stream "~1.0.0" + +commander@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== + +commander@~2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +convert-source-map@^1.5.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== + dependencies: + safe-buffer "~5.1.1" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js@^2.4.0: + version "2.6.5" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" + integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A== + +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +coveralls@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.3.tgz#83b1c64aea1c6afa69beaf50b55ac1bc4d13e2b8" + integrity sha512-viNfeGlda2zJr8Gj1zqXpDMRjw9uM54p7wzZdvLRyOgnAfCe974Dq4veZkjJdxQXbmdppu6flEajFYseHYaUhg== + dependencies: + growl "~> 1.10.0" + js-yaml "^3.11.0" + lcov-parse "^0.0.10" + log-driver "^1.2.7" + minimist "^1.2.0" + request "^2.86.0" + +cross-spawn@^4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" + integrity sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE= + dependencies: + lru-cache "^4.0.1" + which "^1.2.9" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +debug-log@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" + integrity sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8= + +debug@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^2.2.0, debug@^2.3.3, debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.1.0: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +debug@^4.0.1, debug@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +deep-eql@^3.0.0, deep-eql@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" + integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw== + dependencies: + type-detect "^4.0.0" + +deep-equal@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" + integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + integrity sha1-836hXT4T/9m0N9M+GnW1+5eHTLg= + dependencies: + strip-bom "^2.0.0" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + integrity sha1-920GQ1LN9Docts5hnE7jqUdd4gg= + dependencies: + repeating "^2.0.0" + +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +error-ex@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +eslint-config-prettier@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.2.0.tgz#70b946b629cd0e3e98233fd9ecde4cb9778de96c" + integrity sha512-y0uWc/FRfrHhpPZCYflWC8aE0KRJRY04rdZVfl8cL3sEZmOYyaBdhdlQPjKZBnuRMyLVK+JUZr7HaZFClQiH4w== + dependencies: + get-stdin "^6.0.0" + +eslint-plugin-chai-friendly@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.4.1.tgz#9eeb17f92277ba80bb64f0e946c6936a3ae707b4" + integrity sha512-hkpLN7VVoGGsofZjUhcQ+sufC3FgqMJwD0DvAcRfxY1tVRyQyVsqpaKnToPHJQOrRo0FQ0fSEDwW2gr4rsNdGA== + +eslint-plugin-flowtype@^3.4.2: + version "3.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.7.0.tgz#6662392f2daf6056138448b46ebc17c7a83ad337" + integrity sha512-6PAYrfSAd23C6ZTc9OhEpSn4uz5HnaXSOYzBLPiKNAE+WmNnWkgkfrswOK2Rlvn91ofZoba7SR04gitnmW9sqg== + dependencies: + lodash "^4.17.11" + +eslint-plugin-prettier@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.1.tgz#19d521e3981f69dd6d14f64aec8c6a6ac6eb0b0d" + integrity sha512-/PMttrarPAY78PLvV3xfWibMOdMDl57hmlQ2XqFeA37wd+CJ7WSxV7txqjVPHi/AAFKd2lX0ZqfsOc/i5yFCSQ== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-scope@3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug= + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-scope@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + +eslint@^5.16.0: + version "5.16.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" + integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.9.1" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^4.0.3" + eslint-utils "^1.3.1" + eslint-visitor-keys "^1.0.0" + espree "^5.0.1" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^6.2.2" + js-yaml "^3.13.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.11" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^5.5.1" + strip-ansi "^4.0.0" + strip-json-comments "^2.0.1" + table "^5.2.3" + text-table "^0.2.0" + +espree@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" + integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== + dependencies: + acorn "^6.0.7" + acorn-jsx "^5.0.0" + eslint-visitor-keys "^1.0.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= + dependencies: + is-posix-bracket "^0.1.0" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= + dependencies: + fill-range "^2.1.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +external-editor@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + integrity sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= + dependencies: + is-extglob "^1.0.0" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +find-cache-dir@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + integrity sha1-yN765XyKUqinhPnjHFfHQumToLk= + dependencies: + commondir "^1.0.1" + mkdirp "^0.5.1" + pkg-dir "^1.0.0" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" + integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== + +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= + dependencies: + for-in "^1.0.1" + +foreground-child@^1.5.3, foreground-child@^1.5.6: + version "1.5.6" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-1.5.6.tgz#4fd71ad2dfde96789b980a5c0a295937cb2f5ce9" + integrity sha1-T9ca0t/elnibmApcCilZN8svXOk= + dependencies: + cross-spawn "^4" + signal-exit "^3.0.0" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + +get-func-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" + integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= + +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= + dependencies: + is-glob "^2.0.0" + +glob@7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.6, glob@^7.1.2, glob@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" + integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0, globals@^11.7.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +graceful-fs@^4.1.11, graceful-fs@^4.1.2: + version "4.1.15" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" + integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== + +growl@1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" + integrity sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q== + +"growl@~> 1.10.0": + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +handlebars@^4.0.3: + version "4.1.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" + integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== + dependencies: + neo-async "^2.6.0" + optimist "^0.6.1" + source-map "^0.6.1" + optionalDependencies: + uglify-js "^3.1.4" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.0: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + integrity sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo= + +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + integrity sha1-6CB68cx7MNRGzHC3NLXovhj4jVE= + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= + +hosted-git-info@^2.1.4: + version "2.7.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +import-fresh@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" + integrity sha512-pOnA9tfM3Uwics+SaBLCNyZZZbK+4PTu0OPZtLlMIrv17EdBoC15S9Kn8ckJ9TZTyKb3ywNE5y1yeDxxGA7nTQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + +inquirer@^6.2.2: + version "6.3.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.3.1.tgz#7a413b5e7950811013a3db491c61d1f3b776e8e7" + integrity sha512-MmL624rfkFt4TG9y/Jvmt8vdmOo836U7Y0Hxr2aFk3RelZEGX4Igk0KabWrcaaZaTv9uzglOqWh1Vly+FAWAXA== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.11" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +isarray@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +istanbul-lib-coverage@^1.1.2, istanbul-lib-coverage@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.1.tgz#ccf7edcd0a0bb9b8f729feeb0930470f9af664f0" + integrity sha512-PzITeunAgyGbtY1ibVIUiV679EFChHjoMNRibEIobvmrCRaIgwLxNucOSimtNWUhEib/oO7QY2imD75JVgCJWQ== + +istanbul-lib-hook@^1.1.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.2.2.tgz#bc6bf07f12a641fbf1c85391d0daa8f0aea6bf86" + integrity sha512-/Jmq7Y1VeHnZEQ3TL10VHyb564mn6VrQXHchON9Jf/AEcmQ3ZIiyD1BVzNOKTZf/G3gE+kiGK6SmpF9y3qGPLw== + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.10.0: + version "1.10.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.2.tgz#1f55ed10ac3c47f2bdddd5307935126754d0a9ca" + integrity sha512-aWHxfxDqvh/ZlxR8BBaEPVSWDPUkGD63VjGQn3jcw8jCp7sHEMKcrj4xfJn/ABzdMEHiQNyvDQhqm5o8+SQg7A== + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.18.0" + istanbul-lib-coverage "^1.2.1" + semver "^5.3.0" + +istanbul-lib-report@^1.1.3: + version "1.1.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.5.tgz#f2a657fc6282f96170aaf281eb30a458f7f4170c" + integrity sha512-UsYfRMoi6QO/doUshYNqcKJqVmFe9w51GZz8BS3WB0lYxAllQYklka2wP9+dGZeHYaWIdcXUx8JGdbqaoXRXzw== + dependencies: + istanbul-lib-coverage "^1.2.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.2.3: + version "1.2.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.6.tgz#37b9ff661580f8fca11232752ee42e08c6675d8f" + integrity sha512-TtbsY5GIHgbMsMiRw35YBHGpZ1DVFEO19vxxeiDMYaeOFOCzfnYVxvl6pOUIZR4dtPhAGpSMup8OyF8ubsaqEg== + dependencies: + debug "^3.1.0" + istanbul-lib-coverage "^1.2.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.4.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.5.1.tgz#97e4dbf3b515e8c484caea15d6524eebd3ff4e1a" + integrity sha512-+cfoZ0UXzWjhAdzosCPP3AN8vvef8XDkWtTfgaN+7L3YTpNYITnCaEkceo5SEYy644VkHka/P1FvkWvrG/rrJw== + dependencies: + handlebars "^4.0.3" + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@^3.11.0, js-yaml@^3.13.0: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= + dependencies: + invert-kv "^1.0.0" + +lcov-parse@^0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" + integrity sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM= + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= + +lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== + +log-driver@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" + integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== + +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + +md5-hex@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" + integrity sha1-0sSv6YPENwZiF5uMrRRSGRNQRsQ= + dependencies: + md5-o-matic "^0.1.1" + +md5-o-matic@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" + integrity sha1-givM1l4RfFFPqxdrJZRdVBAKA8M= + +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= + dependencies: + mimic-fn "^1.0.0" + +merge-source-map@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" + integrity sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw== + dependencies: + source-map "^0.6.1" + +micromatch@^2.3.11: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +micromatch@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mime-db@1.40.0: + version "1.40.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" + integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.24" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" + integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== + dependencies: + mime-db "1.40.0" + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= + +mixin-deep@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +mocha@~5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.0.5.tgz#e228e3386b9387a4710007a641f127b00be44b52" + integrity sha512-3MM3UjZ5p8EJrYpG7s+29HAI9G7sTzKEe4+w37Dg0QP7qL4XGsV+Q2xet2cE37AqdgN1OtYQB6Vl98YiPV3PgA== + dependencies: + browser-stdout "1.3.1" + commander "2.11.0" + debug "3.1.0" + diff "3.5.0" + escape-string-regexp "1.0.5" + glob "7.1.2" + growl "1.10.3" + he "1.1.1" + mkdirp "0.5.1" + supports-color "4.4.0" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +neo-async@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" + integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +nock@^9.0.0: + version "9.6.1" + resolved "https://registry.yarnpkg.com/nock/-/nock-9.6.1.tgz#d96e099be9bc1d0189a77f4490bbbb265c381b49" + integrity sha512-EDgl/WgNQ0C1BZZlASOQkQdE6tAWXJi8QQlugqzN64JJkvZ7ILijZuG24r4vCC7yOfnm6HKpne5AGExLGCeBWg== + dependencies: + chai "^4.1.2" + debug "^3.1.0" + deep-equal "^1.0.0" + json-stringify-safe "^5.0.1" + lodash "^4.17.5" + mkdirp "^0.5.0" + propagate "^1.0.0" + qs "^6.5.1" + semver "^5.5.0" + +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +nyc@^11.3.0: + version "11.9.0" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.9.0.tgz#4106e89e8fbe73623a1fc8b6ecb7abaa271ae1e4" + integrity sha512-w8OdJAhXL5izerzZMdqzYKMj/pgHJyY3qEPYBjLLxrhcVoHEY9pU5ENIiZyCgG9OR7x3VcUMoD40o6PtVpfR4g== + dependencies: + archy "^1.0.0" + arrify "^1.0.1" + caching-transform "^1.0.0" + convert-source-map "^1.5.1" + debug-log "^1.0.1" + default-require-extensions "^1.0.0" + find-cache-dir "^0.1.1" + find-up "^2.1.0" + foreground-child "^1.5.3" + glob "^7.0.6" + istanbul-lib-coverage "^1.1.2" + istanbul-lib-hook "^1.1.0" + istanbul-lib-instrument "^1.10.0" + istanbul-lib-report "^1.1.3" + istanbul-lib-source-maps "^1.2.3" + istanbul-reports "^1.4.0" + md5-hex "^1.2.0" + merge-source-map "^1.1.0" + micromatch "^3.1.10" + mkdirp "^0.5.0" + resolve-from "^2.0.0" + rimraf "^2.6.2" + signal-exit "^3.0.1" + spawn-wrap "^1.4.2" + test-exclude "^4.2.0" + yargs "11.1.0" + yargs-parser "^8.0.0" + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-parse@^1.0.5, path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +pathval@^1.0.0, pathval@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" + integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA= + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q= + dependencies: + find-up "^1.0.0" + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^1.16.4: + version "1.17.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.0.tgz#53b303676eed22cc14a9f0cec09b477b3026c008" + integrity sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw== + +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +propagate@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/propagate/-/propagate-1.0.0.tgz#00c2daeedda20e87e3782b344adba1cddd6ad709" + integrity sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk= + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + +psl@^1.1.24: + version "1.1.31" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" + integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@^6.5.1, qs@^6.6.0: + version "6.7.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" + integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== + dependencies: + is-equal-shallow "^0.1.3" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.5.2, repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= + dependencies: + is-finite "^1.0.0" + +request@^2.86.0: + version "2.88.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.0" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.4.3" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +resolve-from@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" + integrity sha1-lICrIOlP+h2egKgEx+oUdhGWa1c= + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@^1.10.0: + version "1.10.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18" + integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA== + dependencies: + path-parse "^1.0.6" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +rimraf@2.6.3, rimraf@^2.6.1, rimraf@^2.6.2: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +rxjs@^6.4.0: + version "6.5.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.1.tgz#f7a005a9386361921b8524f38f54cbf80e5d08f4" + integrity sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg== + dependencies: + tslib "^1.9.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.5.1: + version "5.7.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" + integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + integrity sha1-fbCPnT0i3H945Trzw79GZuzfzPE= + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.1" + to-object-path "^0.3.0" + +set-value@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + integrity sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +signal-exit@^3.0.0, signal-exit@^3.0.1, signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + +slide@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.1, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +spawn-wrap@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.4.2.tgz#cff58e73a8224617b6561abdc32586ea0c82248c" + integrity sha512-vMwR3OmmDhnxCVxM8M+xO/FtIp6Ju/mNaDfCMMW7FDcLRTPFWUswec4LXJHTJE2hwTI9O0YBfygu4DalFl7Ylg== + dependencies: + foreground-child "^1.5.6" + mkdirp "^0.5.0" + os-homedir "^1.0.1" + rimraf "^2.6.2" + signal-exit "^3.0.2" + which "^1.3.0" + +spdx-correct@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz#75ecd1a88de8c184ef015eafb51b5b48bfd11bb1" + integrity sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA== + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= + dependencies: + is-utf8 "^0.2.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-json-comments@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +supports-color@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" + integrity sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ== + dependencies: + has-flag "^2.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +supports-color@^3.1.2: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + integrity sha1-ZawFBLOVQXHYpklGsq48u4pfVPY= + dependencies: + has-flag "^1.0.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +table@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/table/-/table-5.2.3.tgz#cde0cc6eb06751c009efab27e8c820ca5b67b7f2" + integrity sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ== + dependencies: + ajv "^6.9.1" + lodash "^4.17.11" + slice-ansi "^2.1.0" + string-width "^3.0.0" + +test-exclude@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.3.tgz#a9a5e64474e4398339245a0a769ad7c2f4a97c20" + integrity sha512-SYbXgY64PT+4GAL2ocI3HwPa4Q4TBKm0cwAVeKOt/Aoc0gSpNRjJX8w0pA1LMKZ3LBmd8pYBqApFNQLII9kavA== + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +tough-cookie@~2.4.3: + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== + dependencies: + psl "^1.1.24" + punycode "^1.4.1" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= + +tslib@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" + integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type-detect@^4.0.0, type-detect@^4.0.5: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +uglify-js@^3.1.4: + version "3.5.10" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.10.tgz#652bef39f86d9dbfd6674407ee05a5e2d372cf2d" + integrity sha512-/GTF0nosyPLbdJBd+AwYiZ+Hu5z8KXWnO0WCGt1BQ/u9Iamhejykqmz5o1OHJ53+VAk6xVxychonnApDjuqGsw== + dependencies: + commander "~2.20.0" + source-map "~0.6.1" + +union-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + integrity sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ= + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^0.4.3" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +uuid@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@^1.2.9, which@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@^1.1.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" + integrity sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8= + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + slide "^1.1.5" + +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + +yargs-parser@^8.0.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950" + integrity sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ== + dependencies: + camelcase "^4.1.0" + +yargs-parser@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" + integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc= + dependencies: + camelcase "^4.1.0" + +yargs@11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" + integrity sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A== + dependencies: + cliui "^4.0.0" + decamelize "^1.1.1" + find-up "^2.1.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^9.0.2"