mockaton 8.1.4 → 8.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +13 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,7 @@ By the way, [this browser
12
12
  extension](https://github.com/ericfortis/devtools-ext-tar-http-requests)
13
13
  can create a TAR of your XHR requests following that convention.
14
14
 
15
+ ### Dashboard Example
15
16
 
16
17
  <picture>
17
18
  <source media="(prefers-color-scheme: light)" srcset="./README-dashboard-light.png">
@@ -44,7 +45,7 @@ node --import=tsx my-mockaton.js
44
45
  ```
45
46
 
46
47
 
47
- ## Running the Example Demo
48
+ ## Running the Example
48
49
  This demo uses the [sample-mocks/](./sample-mocks) directory of this repository.
49
50
 
50
51
  - Checkout this repo
@@ -57,8 +58,8 @@ Experiment with the Dashboard:
57
58
 
58
59
  - Pick a mock variant from the Mock dropdown (we’ll discuss
59
60
  them later)
60
- - Toggle the clock icon, which _Delays_ responses (e.g. for testing spinners)
61
- - Toggle _500_ button, which sends and _Internal Server Error_ on that endpoint
61
+ - Toggle the 🕓 Clock button, which _Delays_ responses (e.g. for testing spinners)
62
+ - Toggle the _500_ button, which sends and _Internal Server Error_ on that endpoint
62
63
 
63
64
  Finally, edit a mock file. You don’t need to restart Mockaton for that. The
64
65
  _Reset_ button is for registering newly added, removed, or renamed mocks.
@@ -92,10 +93,10 @@ _Reset_ button is for registering newly added, removed, or renamed mocks.
92
93
  Each route can have many mocks, which could either be:
93
94
  - Different response __status code__. For example, for testing error responses.
94
95
  - __Comment__ on the filename, which is anything within parentheses.
95
- - e.g. `api/user(my-comment).POST.201.json`
96
+ - e.g. `api/login(locked out user).POST.423.json`
96
97
 
97
- Those alternatives can be manually selected in the dashboard
98
- UI, or programmatically, for instance, for setting up tests.
98
+ Those alternatives can be manually selected on the dashboard, or
99
+ programmatically (see **Commander API** section), for instance, for setting up tests.
99
100
 
100
101
  ### Default Mock for a Route
101
102
  You can add the comment: `(default)` to a filename.
@@ -215,8 +216,7 @@ Defaults to `/(\.DS_Store|~)$/`
215
216
 
216
217
 
217
218
  ### `delay?: number` 🕓
218
- The clock icon next to the mock selector is a checkbox for delaying a
219
- particular response. They are handy for testing spinners.
219
+ The clock icon next to the mock selector is a checkbox for delaying a particular response.
220
220
 
221
221
  The delay is globally configurable via `Config.delay = 1200` (milliseconds).
222
222
 
@@ -228,7 +228,7 @@ For example, `Config.proxyFallback = 'http://example.com:8080'`
228
228
 
229
229
  ### `staticDir?: string`
230
230
  Files under `Config.staticDir` don’t use the filename convention.
231
- Also, they take precedence over the `GET` mocks in `Config.mockDir`.
231
+ Also, they take precedence over the `GET` mocks in `Config.mocksDir`.
232
232
 
233
233
  For example, if you have two files for `GET /foo/bar.jpg`
234
234
  ```
@@ -249,8 +249,8 @@ The key is just a label used for selecting a particular cookie in the
249
249
  dashboard. In the dashboard, only one cookie can be selected. If you need
250
250
  more cookies you can inject additional cookies globally in `Config.extraHeaders`.
251
251
 
252
- `jwtCookie` has a hardcoded header and signature. In other
253
- words, it’s useful if you only care about its payload.
252
+ By the way, there’s a `jwtCookie` helper, which has a hardcoded header and
253
+ signature. In other words, it’s useful if you only care about its payload.
254
254
 
255
255
  ```js
256
256
  import { jwtCookie } from 'mockaton'
@@ -280,7 +280,7 @@ Config.extraHeaders = [
280
280
  ### `extraMimes?: { [fileExt: string]: string }`
281
281
  ```js
282
282
  Config.extraMimes = {
283
- jpg: 'application/jpeg'
283
+ jpe: 'application/jpeg'
284
284
  }
285
285
  ```
286
286
 
@@ -364,7 +364,7 @@ Config.onReady = open
364
364
 
365
365
  ---
366
366
 
367
- ## HTTP API
367
+ ## Commander API
368
368
  `Commander` is a wrapper for the Mockaton HTTP API.
369
369
  All of its methods return their `fetch` response promise.
370
370
  ```js
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "A deterministic server-side for developing and testing frontend clients",
4
4
  "type": "module",
5
- "version": "8.1.4",
5
+ "version": "8.1.6",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "license": "MIT",