Skip to content

Commit

Permalink
Use the generated API version (#1457)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe authored Jun 21, 2022
1 parent aeb605f commit 1bd43f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/apiVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// File generated from our OpenAPI spec

module.exports = {ApiVersion: '2020-08-27'};
3 changes: 2 additions & 1 deletion lib/stripe.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';

const resources = require('./resources');
const apiVersion = require('./apiVersion');

const DEFAULT_HOST = 'api.stripe.com';
const DEFAULT_PORT = '443';
const DEFAULT_BASE_PATH = '/v1/';
const DEFAULT_API_VERSION = null;
const DEFAULT_API_VERSION = apiVersion.ApiVersion;

const DEFAULT_TIMEOUT = 80000;

Expand Down
4 changes: 2 additions & 2 deletions test/stripe.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('Stripe Module', function() {
}).not.to.throw();
});

it('should perform a no-op if null, undefined or empty values are passed', () => {
it('should return a default version when null, undefined or empty values are passed', () => {
const cases = [null, undefined, '', {}];

cases.forEach((item) => {
Expand All @@ -112,7 +112,7 @@ describe('Stripe Module', function() {

cases.forEach((item) => {
const stripe = Stripe(testUtils.getUserStripeKey(), item);
expect(stripe.getApiField('version')).to.equal(null);
expect(stripe.getApiField('version')).to.not.equal(null);
});
});

Expand Down

0 comments on commit 1bd43f1

Please sign in to comment.