mockaton 6.4.3 → 6.4.5
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.
- package/README.md +21 -15
- package/package.json +1 -1
- package/src/Api.js +1 -0
- package/src/Dashboard.css +3 -5
- package/src/Dashboard.js +1 -1
- package/src/mockaton-logo.svg +4 -0
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="src/mockaton-logo.svg" alt="Mockaton Logo" width="210" style="margin-top: 30px"/>
|
|
2
|
+
|
|
2
3
|
_Mockaton_ is a mock server for developing and testing frontends.
|
|
3
4
|
|
|
4
5
|
It scans a given directory for files following a specific
|
|
@@ -134,18 +135,6 @@ export default function optionalName(request, response) {
|
|
|
134
135
|
```
|
|
135
136
|
|
|
136
137
|
|
|
137
|
-
## Proxying Routes
|
|
138
|
-
`Config.proxyFallback` lets you specify a target
|
|
139
|
-
server for serving routes you don’t have mocks for.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
## Delay 🕓
|
|
143
|
-
The clock icon next to the mock selector is a checkbox for delaying a
|
|
144
|
-
particular response. They are handy for testing spinners.
|
|
145
|
-
|
|
146
|
-
The delay is globally configurable via `Config.delay = 1200` (milliseconds).
|
|
147
|
-
|
|
148
|
-
|
|
149
138
|
## File Name Convention
|
|
150
139
|
|
|
151
140
|
|
|
@@ -197,6 +186,19 @@ api/foo/.GET.200.json
|
|
|
197
186
|
```
|
|
198
187
|
|
|
199
188
|
---
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## `Config.proxyFallback`
|
|
192
|
+
Lets you specify a target server for serving routes you don’t have mocks for.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## `Config.delay` 🕓
|
|
196
|
+
The clock icon next to the mock selector is a checkbox for delaying a
|
|
197
|
+
particular response. They are handy for testing spinners.
|
|
198
|
+
|
|
199
|
+
The delay is globally configurable via `Config.delay = 1200` (milliseconds).
|
|
200
|
+
|
|
201
|
+
|
|
200
202
|
## `Config.staticDir`
|
|
201
203
|
These files don’t use the mock filename convention. They take precedence
|
|
202
204
|
over mocks. Also, they get served on the same address, so no CORS issues.
|
|
@@ -326,10 +328,14 @@ fetch(addr + '/mockaton/fallback', {
|
|
|
326
328
|
|
|
327
329
|
### Reset
|
|
328
330
|
Re-initialize the collection. So if you added or removed mocks they
|
|
329
|
-
will be considered. The selected mocks, cookies, and delays
|
|
330
|
-
back to default
|
|
331
|
+
will be considered. The selected mocks, cookies, and delays go
|
|
332
|
+
back to default, but `Config.proxyFalllback` is not affected.
|
|
331
333
|
```js
|
|
332
334
|
fetch(addr + '/mockaton/reset', {
|
|
333
335
|
method: 'PATCH'
|
|
334
336
|
})
|
|
335
337
|
```
|
|
338
|
+
|
|
339
|
+
## TODO
|
|
340
|
+
- Dashboard. List `staticDir` and indicate if it’s overriding some mock.
|
|
341
|
+
- Refactor Tests
|
package/package.json
CHANGED
package/src/Api.js
CHANGED
|
@@ -18,6 +18,7 @@ export const apiGetRequests = new Map([
|
|
|
18
18
|
['/Dashboard.js', serveDashboardAsset],
|
|
19
19
|
['/Dashboard.css', serveDashboardAsset],
|
|
20
20
|
['/ApiConstants.js', serveDashboardAsset],
|
|
21
|
+
['/mockaton-logo.svg', serveDashboardAsset],
|
|
21
22
|
[API.mocks, listMockBrokers],
|
|
22
23
|
[API.cookies, listCookies],
|
|
23
24
|
[API.comments, listComments]
|
package/src/Dashboard.css
CHANGED
|
@@ -63,10 +63,8 @@ menu {
|
|
|
63
63
|
margin-bottom: 12px;
|
|
64
64
|
gap: 14px;
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
margin:
|
|
68
|
-
margin-right: 12px;
|
|
69
|
-
font-size: 26px;
|
|
66
|
+
img {
|
|
67
|
+
margin-right: 16px;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
label {
|
|
@@ -107,7 +105,7 @@ menu {
|
|
|
107
105
|
top: 0;
|
|
108
106
|
width: 50%;
|
|
109
107
|
margin-left: 16px;
|
|
110
|
-
|
|
108
|
+
|
|
111
109
|
h2 {
|
|
112
110
|
padding-top: 20px;
|
|
113
111
|
}
|
package/src/Dashboard.js
CHANGED
|
@@ -54,7 +54,7 @@ function DevPanel(brokersByMethod, cookies, comments) {
|
|
|
54
54
|
return (
|
|
55
55
|
r('div', null,
|
|
56
56
|
r('menu', null,
|
|
57
|
-
r('
|
|
57
|
+
r('img', { src: 'mockaton-logo.svg', width: 160 }),
|
|
58
58
|
r(CookieSelector, { list: cookies }),
|
|
59
59
|
r(BulkSelector, { comments }),
|
|
60
60
|
r(ResetButton)),
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg version="1.1" viewBox="0 0 570 100" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="m77 0.27c2.7 0 6 1.3 9.1 2.6 2.9 1.1 4.2 3.3 4.2 6.5v84c0 3.8-2.4 5.8-7.2 5.8s-7.2-2-7.2-5.8v-63l-3.5-0.36-20 64c-0.92 2.9-3.2 4.2-6.6 4.1-1.5-0.079-2.9-0.47-4-1.2-1.2-0.71-2-1.8-2.3-3.2l-8.8-29-5.3-17c-1.8-5.8-3.7-13-5.8-20l-3.5 0.48v63c0 3.8-2.4 5.8-7.2 5.8s-7.2-2-7.2-5.8v-84c0-3.1 1.4-5.2 4.2-6.5 3.1-1.3 5.9-1.8 8.7-1.7 1.3 0 2.5 0.16 3.7 0.48 1.3 0.33 2.5 0.82 3.6 1.5 1.1 0.57 2.2 1.3 3.1 2.3 0.92 0.92 1.6 2 2.1 3.2l19 65c1.4-4.8 2.9-9.9 4.4-16 1.6-5.9 3.2-11 4.7-17 1.6-5.9 3.2-11 4.7-17 1.7-5.7 3.2-11 4.5-16 0.48-1.1 1.2-2.2 2.1-3.1 0.89-0.89 1.9-1.7 3.1-2.2 1.1-0.65 2.3-1.2 3.5-1.5 1.3-0.33 2.6-0.48 3.7-0.48m35 30h-0.12c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