3 ms·
Maybe noob questions, but how to do tests with stripe API? For example, how to write a test for plan upgrade? From what I remember there can be set testing env
by pplonski86 8y ago
Maybe noob questions, but how to do tests with stripe API? For example, how to write a test for plan upgrade? From what I remember there can be set testing env in stripe but the shortest subscription time was 1 day, so how to use it in automatic tests?
- harrisonjackson 8y agoWe disable live API interaction w/ stripe in our tests and use hardcoded response values. You can use a library to do this or patch the stripe sdk - depending on the language/framework you are using.
- bdibs 8y agoJust create a stub with the possible responses.
- ezekg 8y agoYou should never write tests against a live API. Always mock APIs and handle what happens when e.g. they send a 501 response, etc. Stripe has testing libraries in Ruby and other languages which are very easy to use.