minimonolith 0.22.0 → 0.22.1
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/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
export default async server => {
|
|
2
|
+
const fetch = (await import('cross-fetch')).default;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const port = server.address().port
|
|
5
|
-
const url = `http://localhost:${port}${path}`;
|
|
4
|
+
return async ({ path, method, expectedCode, headers, body }) => {
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const port = server.address().port
|
|
7
|
+
const url = `http://localhost:${port}${path}`;
|
|
8
|
+
|
|
9
|
+
const response = await fetch(url, { method, headers, body });
|
|
10
|
+
expect(response.status).toBe(expectedCode);
|
|
11
|
+
};
|
|
12
|
+
};
|