#victor-connexion

1 messages · Page 1 of 1 (latest)

trail fractalBOT
gleaming briar
real flint
#

stripe-mock is not available in npm registry

#

is that best practice?

gleaming briar
#

Well it's not Node so yes not in npm. It runs as a standalone Go server to replace the "real" Stripe API

real flint
#

thanks for the suggestion , however . is there alternative ? unit test need to be in node

gleaming briar
#

See example here.

#

TLDRl; you run stripe-mock as a docker instance and mocking the client by

  getStripeMockClient: () => {
    const stripe = require('../lib/stripe');

    return stripe('sk_test_123', {
      host: process.env.STRIPE_MOCK_HOST || 'localhost',
      port: process.env.STRIPE_MOCK_PORT || 12111,
      protocol: 'http',
    });
  },