piral-fetch 1.3.3-beta.6187 → 1.3.3-beta.6201
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 +3 -3
- package/src/create.test.ts +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-fetch",
|
|
3
|
-
"version": "1.3.3-beta.
|
|
3
|
+
"version": "1.3.3-beta.6201",
|
|
4
4
|
"description": "Plugin for standardizing fetch in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/express": "^4.11.1",
|
|
66
66
|
"cors": "^2.8.5",
|
|
67
67
|
"express": "^4.17.1",
|
|
68
|
-
"piral-core": "1.3.3-beta.
|
|
68
|
+
"piral-core": "1.3.3-beta.6201"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "6e9f4e6f83514b5c38960ce015e073efc668f3d6"
|
|
71
71
|
}
|
package/src/create.test.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
1
4
|
import 'url-polyfill';
|
|
2
5
|
import 'whatwg-fetch';
|
|
6
|
+
import { describe, it, expect, vitest, beforeAll, afterAll } from 'vitest';
|
|
3
7
|
import { createFetchApi } from './create';
|
|
4
8
|
|
|
5
9
|
describe('Create fetch API Module', () => {
|
|
@@ -39,7 +43,7 @@ describe('Create fetch API Module', () => {
|
|
|
39
43
|
afterAll(() => terminate());
|
|
40
44
|
|
|
41
45
|
it('works with default options against a JSON API', async () => {
|
|
42
|
-
const context = { emit:
|
|
46
|
+
const context = { emit: vitest.fn() } as any;
|
|
43
47
|
const { fetch } = createFetchApi({
|
|
44
48
|
base: `http://localhost:${port}`,
|
|
45
49
|
})(context) as any;
|
|
@@ -51,7 +55,7 @@ describe('Create fetch API Module', () => {
|
|
|
51
55
|
});
|
|
52
56
|
|
|
53
57
|
it('interprets the result as text if explicitly used despite JSON API', async () => {
|
|
54
|
-
const context = { emit:
|
|
58
|
+
const context = { emit: vitest.fn() } as any;
|
|
55
59
|
const { fetch } = createFetchApi({
|
|
56
60
|
base: `http://localhost:${port}`,
|
|
57
61
|
})(context) as any;
|
|
@@ -62,7 +66,7 @@ describe('Create fetch API Module', () => {
|
|
|
62
66
|
});
|
|
63
67
|
|
|
64
68
|
it('has the correct response code', async () => {
|
|
65
|
-
const context = { emit:
|
|
69
|
+
const context = { emit: vitest.fn() } as any;
|
|
66
70
|
const { fetch } = createFetchApi({
|
|
67
71
|
base: `http://localhost:${port}`,
|
|
68
72
|
})(context) as any;
|
|
@@ -72,7 +76,7 @@ describe('Create fetch API Module', () => {
|
|
|
72
76
|
});
|
|
73
77
|
|
|
74
78
|
it('works with default options against a non-JSON API', async () => {
|
|
75
|
-
const context = { emit:
|
|
79
|
+
const context = { emit: vitest.fn() } as any;
|
|
76
80
|
const { fetch } = createFetchApi({
|
|
77
81
|
base: `http://localhost:${port}`,
|
|
78
82
|
})(context) as any;
|