Skip to content

Commit 8efd206

Browse files
committed
Update the formdata-node dev dependency to v3, simplify related tests.
1 parent 234e44d commit 8efd206

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@
7070
"eslint-plugin-react": "^7.23.2",
7171
"eslint-plugin-react-hooks": "^4.2.0",
7272
"event-target-shim": "^6.0.2",
73-
"fetch-blob": "^2.1.1",
7473
"filter-console": "^0.1.1",
75-
"formdata-node": "^2.5.0",
74+
"formdata-node": "^3.1.1",
7675
"gzip-size": "^6.0.0",
7776
"jsdoc-md": "^9.1.1",
7877
"node-fetch": "^3.0.0-beta.9",

test/public/fetchOptionsGraphQL.test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'use strict';
22

33
const { deepStrictEqual, strictEqual } = require('assert');
4-
const Blob = require('fetch-blob');
5-
const FormData = require('formdata-node');
4+
const { File, FormData } = require('formdata-node');
65
const revertableGlobals = require('revertable-globals');
76
const fetchOptionsGraphQL = require('../../public/fetchOptionsGraphQL');
87

@@ -19,13 +18,13 @@ module.exports = (tests) => {
1918
});
2019

2120
tests.add('`fetchOptionsGraphQL` with files.', () => {
22-
const revertGlobals = revertableGlobals({ Blob, FormData });
21+
const revertGlobals = revertableGlobals({ File, FormData });
2322

2423
try {
25-
const filetype = 'text/plain';
24+
const fileName = 'a.txt';
2625
const options = fetchOptionsGraphQL({
2726
query: '',
28-
variables: { a: new Blob(['a'], { type: filetype }) },
27+
variables: { a: new File(['a'], fileName) },
2928
});
3029

3130
// See the GraphQL multipart request spec:
@@ -44,9 +43,8 @@ module.exports = (tests) => {
4443
]);
4544
deepStrictEqual(formDataEntries[1], ['map', '{"1":["variables.a"]}']);
4645
strictEqual(formDataEntries[2][0], '1');
47-
strictEqual(formDataEntries[2][1] instanceof Blob, true);
48-
strictEqual(formDataEntries[2][1].name, 'blob');
49-
strictEqual(formDataEntries[2][1].type, filetype);
46+
strictEqual(formDataEntries[2][1] instanceof File, true);
47+
strictEqual(formDataEntries[2][1].name, fileName);
5048
} finally {
5149
revertGlobals();
5250
}

0 commit comments

Comments
 (0)