We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you add the following lines to the index.test.js for FormData, you get a failure:
index.test.js
FormData
const fileData = new FormData(); const file = new File(["foo"], "foo.txt", { type: "text/plain" }); fileData.set("file", file); expect(fileData.get("file")).toBe(file);
If you console.log(typeof fileData.get("file"), fileData.get("file")), you see that it's a string: "[object File]"
console.log(typeof fileData.get("file"), fileData.get("file"))
string
"[object File]"
As a comparision, the test can be fixed by doing the following to use JSDOM directly:
const JSDOM = require("jsdom").JSDOM; const dom = new JSDOM(); const fileData = new dom.window.FormData(); const file = new dom.window.File(["foo"], "foo.txt", { type: "text/plain" }); fileData.set("file", file); expect(fileData.get("file")).toBe(file);
(note that you have to use both dom.window.FormData and dom.window.File in the fix for it to pass tests)
dom.window.FormData
dom.window.File
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If you add the following lines to the
index.test.js
forFormData
, you get a failure:If you
console.log(typeof fileData.get("file"), fileData.get("file"))
, you see that it's astring
:"[object File]"
As a comparision, the test can be fixed by doing the following to use JSDOM directly:
(note that you have to use both
dom.window.FormData
anddom.window.File
in the fix for it to pass tests)The text was updated successfully, but these errors were encountered: