From a1585aa4c6b080fc113ad8a081878215ba616950 Mon Sep 17 00:00:00 2001 From: Roan Paulus Date: Thu, 12 Dec 2024 10:39:31 +0100 Subject: [PATCH] Fix broken mock, added mock documentation for variants --- mocks/README.md | 17 +++++++++++++++++ mocks/routes/parkeren.js | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mocks/README.md b/mocks/README.md index 57cb3ccbde..27020d90b1 100644 --- a/mocks/README.md +++ b/mocks/README.md @@ -1,3 +1,20 @@ +# Usage + +## Variant switching + +[Official Documentation](https://www.mocks-server.org/docs/usage/variants/) + +It can be handy to switch datasets for testing. +For example, when you need to see what happens when an api would give no data, but another one does. + +To use different data sets. +You can select a variant or collection with the arrow keys in the mock server menu or +permanently in the `mocks.config.js` file. + +When adding a new variant try to group them under a name already present. +So we don't end up with variants called `void`, `no-data` and `nothing` for the same thing. +You can check what is already there in `collections.json` or in the menu. + # Adding a router 1. Add your endpoint in `/routes`. See example 1 below: diff --git a/mocks/routes/parkeren.js b/mocks/routes/parkeren.js index 7dbcd3a322..7a88e1325b 100644 --- a/mocks/routes/parkeren.js +++ b/mocks/routes/parkeren.js @@ -4,10 +4,10 @@ const NO_DATA_VARIANT = { id: 'no-data', type: 'json', options: { + status: 200, body: { result: 'success', count: 0, - status: 200, data: [], }, },