Git Product home page Git Product logo

pay-wiremock-stubs's Introduction

pay-wiremock-stubs

Intended to replace GOV.UK Pay's pay-stubs (private) project. The motivations for doing so are as follows:

  • Pay's skill set is more geared towards Java, but pay-stubs is built in Node.
  • Related to the above, pay-stubs is a running server we have to maintain and uses 38 libraries at the time of writing. In contrast this pay-wiremock-stubs project only requires 3 libraries.
  • We've been wanting to make pay-stubs send capture notifications since 3/4/23. This would ensure we're accurately performance testing our environment.
  • Java devs already use Wiremock for integration tests so there is familiarity with the DSL.
  • Stubbing becomes a matter of configuring the Wiremock SaaS service, rather than coding a stub and making it go through a deployment pipeline.

How to run

I have a Wiremock cloud account at https://lrmjj.wiremockapi.cloud. To set up the stubs, run the main method of SetupWiremockStubs. This requires a Wiremock token which corresponds to an environment variable WIREMOCK_API_TOKEN. Note that if you re-run main you'll set up duplicate stubs in the Wiremock account. There is a TODO on how to make sure this cannot happen.

Run SetupWiremockStubsTest to verify the stubs have been set up correctly on Wiremock cloud. These tests should correspond to the unit tests in pay-stubs.

How to demo

  • Spin up ngrok server and get the public address.
  • Set the WEBHOOK_URL env var to the public address got from above.
  • Clear out the stubs on the stubs page.
  • Run SetupWiremockStubs.main and verify stubs have been created.
  • Run SetupWiremockStubsTest and verify all tests pass.
  • Navigate to http://localhost:4040/inspect/http (this is an ngrok feature) to verify the webhook for the capture request was received. Verify the orderCode matches the orderCode in the captureRequest.xml.

pay-wiremock-stubs's People

Contributors

oswaldquek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.