Skip to content

Commit

Permalink
Replace more require('../lib/stripe') with Stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
anniel-stripe committed Nov 1, 2022
1 parent ca5079f commit 4468b74
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions test/stripe.spec.js
Expand Up @@ -282,13 +282,13 @@ describe('Stripe Module', function() {
expect(stripe.getApiField('timeout')).to.equal(defaultTimeout);
});
it('Should allow me to set a custom timeout', () => {
const stripe = require('../lib/stripe')('sk_test', {
const stripe = Stripe('sk_test', {
timeout: 900,
});
expect(stripe.getApiField('timeout')).to.equal(900);
});
it('Should allow me to set null, to reset to the default', () => {
const stripe = require('../lib/stripe')('sk_test', {
const stripe = Stripe('sk_test', {
timeout: null,
});
expect(stripe.getApiField('timeout')).to.equal(defaultTimeout);
Expand All @@ -311,7 +311,7 @@ describe('Stripe Module', function() {
describe('when given a non-object variable', () => {
it('should throw an error', () => {
expect(() => {
require('../lib/stripe')('sk_test', {
Stripe('sk_test', {
appInfo: 'foo',
});
}).to.throw(/AppInfo must be an object./);
Expand All @@ -321,21 +321,21 @@ describe('Stripe Module', function() {
describe('when given an object with no `name`', () => {
it('should throw an error', () => {
expect(() => {
require('../lib/stripe')('sk_test', {
Stripe('sk_test', {
appInfo: {},
});
}).to.throw(/AppInfo.name is required/);

expect(() => {
require('../lib/stripe')('sk_test', {
Stripe('sk_test', {
appInfo: {
version: '1.2.3',
},
});
}).to.throw(/AppInfo.name is required/);

expect(() => {
require('../lib/stripe')('sk_test', {
Stripe('sk_test', {
appInfo: {
cats: '42',
},
Expand All @@ -346,7 +346,7 @@ describe('Stripe Module', function() {

describe('when given at least a `name`', () => {
it('should set name, partner ID, url, and version of stripe._appInfo', () => {
let stripe = require('../lib/stripe')('sk_test', {
let stripe = Stripe('sk_test', {
appInfo: {
name: 'MyAwesomeApp',
},
Expand All @@ -355,7 +355,7 @@ describe('Stripe Module', function() {
name: 'MyAwesomeApp',
});

stripe = require('../lib/stripe')('sk_test', {
stripe = Stripe('sk_test', {
appInfo: {
name: 'MyAwesomeApp',
version: '1.2.345',
Expand All @@ -366,7 +366,7 @@ describe('Stripe Module', function() {
version: '1.2.345',
});

stripe = require('../lib/stripe')('sk_test', {
stripe = Stripe('sk_test', {
appInfo: {
name: 'MyAwesomeApp',
url: 'https://myawesomeapp.info',
Expand All @@ -377,7 +377,7 @@ describe('Stripe Module', function() {
url: 'https://myawesomeapp.info',
});

stripe = require('../lib/stripe')('sk_test', {
stripe = Stripe('sk_test', {
appInfo: {
name: 'MyAwesomeApp',
partner_id: 'partner_1234',
Expand All @@ -390,7 +390,7 @@ describe('Stripe Module', function() {
});

it('should ignore any invalid properties', () => {
const stripe = require('../lib/stripe')('sk_test', {
const stripe = Stripe('sk_test', {
appInfo: {
name: 'MyAwesomeApp',
partner_id: 'partner_1234',
Expand All @@ -415,7 +415,7 @@ describe('Stripe Module', function() {
url: 'https://myawesomeapp.info',
};

const stripe = require('../lib/stripe')('sk_test', {
const stripe = Stripe('sk_test', {
appInfo,
});

Expand Down Expand Up @@ -519,7 +519,6 @@ describe('Stripe Module', function() {

describe('errors', () => {
it('Exports errors as types', () => {
const Stripe = require('../lib/stripe');
expect(
new Stripe.errors.StripeInvalidRequestError({
message: 'error',
Expand Down

0 comments on commit 4468b74

Please sign in to comment.