├── .github └── workflows │ ├── test.yml │ └── trigger_partner_docs_update.yml ├── .gitignore ├── DIFF.md ├── LEARNING.md ├── README.md ├── consumer ├── .env ├── .eslintrc.json ├── package-lock.json ├── package.json ├── public │ ├── index.html │ └── sad_panda.gif └── src │ ├── App.css │ ├── App.js │ ├── ErrorBoundary.js │ ├── Heading.js │ ├── Layout.js │ ├── ProductPage.js │ ├── api.js │ ├── api.pact.spec.js │ ├── api.spec.js │ ├── index.css │ ├── index.js │ └── logo.svg ├── diagrams ├── workshop_step1.svg ├── workshop_step10_broker.svg ├── workshop_step1_class-sequence-diagram.svg ├── workshop_step1_failed_page.png ├── workshop_step2_failed_page.png ├── workshop_step2_unit_test.svg ├── workshop_step3_pact.svg ├── workshop_step4_pact.svg └── workshop_step5_pact.svg ├── docker-compose.yaml ├── package-lock.json ├── package.json └── provider ├── .eslintrc.json ├── middleware └── auth.middleware.js ├── package-lock.json ├── package.json ├── product ├── product.controller.js ├── product.js ├── product.pact.test.js ├── product.repository.js └── product.routes.js └── server.js /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | test: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-node@v4 18 | with: 19 | node-version: '20' 20 | - run: docker compose up -d 21 | - run: npm i 22 | - run: npm test --prefix consumer 23 | - run: npm run pact:publish --prefix consumer 24 | - run: npm test --prefix provider 25 | -------------------------------------------------------------------------------- /.github/workflows/trigger_partner_docs_update.yml: -------------------------------------------------------------------------------- 1 | name: Trigger update to partners.pactflow.io 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - '**.md' 9 | 10 | jobs: 11 | run: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Trigger docs.pact.io update workflow 15 | run: | 16 | curl -X POST https://api.github.com/repos/pactflow/partners.pactflow.io/dispatches \ 17 | -H 'Accept: application/vnd.github.everest-preview+json' \ 18 | -H "Authorization: Bearer $GITHUB_TOKEN" \ 19 | -d '{"event_type": "pact-workshop-js-updated"}' 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.GHTOKENFORTRIGGERINGPACTDOCSUPDATE }} 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | .idea/ 4 | 5 | # dependencies 6 | node_modules/ 7 | .pnp/ 8 | .pnp.js 9 | 10 | # testing 11 | coverage 12 | 13 | # production 14 | build/ 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | pacts/ 28 | logs/ -------------------------------------------------------------------------------- /DIFF.md: -------------------------------------------------------------------------------- 1 | # Here are the diffs between each step 2 | 3 | [step 1 -> step 2](https://github.com/pact-foundation/pact-workshop-js/compare/step1...step2) 4 | 5 | [step 2 -> step 3](https://github.com/pact-foundation/pact-workshop-js/compare/step2...step3) 6 | 7 | [step 3 -> step 4](https://github.com/pact-foundation/pact-workshop-js/compare/step3...step4) 8 | 9 | [step 4 -> step 5](https://github.com/pact-foundation/pact-workshop-js/compare/step4...step5) 10 | 11 | [step 5 -> step 6](https://github.com/pact-foundation/pact-workshop-js/compare/step5...step6) 12 | 13 | [step 6 -> step 7](https://github.com/pact-foundation/pact-workshop-js/compare/step6...step7) 14 | 15 | [step 7 -> step 8](https://github.com/pact-foundation/pact-workshop-js/compare/step7...step8) 16 | 17 | [step 8 -> step 9](https://github.com/pact-foundation/pact-workshop-js/compare/step8...step9) 18 | 19 | [step 9 -> step 10](https://github.com/pact-foundation/pact-workshop-js/compare/step9...step10) 20 | 21 | [step 10 -> step 11](https://github.com/pact-foundation/pact-workshop-js/compare/step10...step11) 22 | -------------------------------------------------------------------------------- /LEARNING.md: -------------------------------------------------------------------------------- 1 | # Learning Outcomes 2 | 3 | 4 | | Step | Title | Concept Covered | Learning objectives | Further Reading | 5 | |----------------------------------------------------------------------|---------------------------------------------------------|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| 6 | | [step 1](https://github.com/pact-foundation/pact-workshop-js/tree/step1) | Create our consumer before the Provider API even exists | Consumer-driven design |
Name | 46 |Type | 47 |48 | |
---|
33 |
34 | {history && history.state && history.state.error ? history.state.error : "Oh noes"}
35 |
36 |
37 | ID: {this.state.product.id}
42 |Name: {this.state.product.name}
43 |Type: {this.state.product.type}
44 |