@vyriy/smoke 0.2.1 → 0.3.2
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 +11 -3
- package/package.json +1 -1
- package/smoke.js +7 -2
- package/types.d.ts +2 -1
package/README.md
CHANGED
|
@@ -42,13 +42,21 @@ if (result) {
|
|
|
42
42
|
Default smoke request payload: `{ isSmoke: true }`.
|
|
43
43
|
|
|
44
44
|
- `response`
|
|
45
|
-
Default smoke response
|
|
45
|
+
Default API Gateway-compatible smoke response:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
{
|
|
49
|
+
statusCode: 200,
|
|
50
|
+
body: JSON.stringify({
|
|
51
|
+
status: 'success',
|
|
52
|
+
}),
|
|
53
|
+
}
|
|
54
|
+
```
|
|
46
55
|
|
|
47
56
|
- `smoke(event)`
|
|
48
57
|
Returns the smoke response when `event` matches the smoke request, otherwise returns `false`.
|
|
49
58
|
|
|
50
59
|
## Notes
|
|
51
60
|
|
|
52
|
-
- matching
|
|
53
|
-
- if property order differs, objects that are otherwise structurally equal may not match
|
|
61
|
+
- matching checks whether the incoming event is an object with `isSmoke: true`
|
|
54
62
|
- the helper is best suited for small, stable smoke payloads
|
package/package.json
CHANGED
package/smoke.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export const request = { isSmoke: true };
|
|
2
|
-
export const response = {
|
|
2
|
+
export const response = {
|
|
3
|
+
statusCode: 200,
|
|
4
|
+
body: JSON.stringify({
|
|
5
|
+
status: 'success',
|
|
6
|
+
}),
|
|
7
|
+
};
|
|
3
8
|
export const smoke = (event) => {
|
|
4
|
-
if (
|
|
9
|
+
if (typeof event === 'object' && event && 'isSmoke' in event && event.isSmoke === request.isSmoke) {
|
|
5
10
|
return response;
|
|
6
11
|
}
|
|
7
12
|
return false;
|
package/types.d.ts
CHANGED