Skip to content

Commit 5761411

Browse files
committed
fixed not use jsdom File object
1 parent a0e9c16 commit 5761411

File tree

4 files changed

+2049
-2259
lines changed

4 files changed

+2049
-2259
lines changed

packages/lib/ajax-save/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.1.3",
2+
"version": "0.1.4",
33
"name": "ajax-save",
44
"repository": {
55
"type": "git",

packages/lib/ajax-save/src/__tests__/readUploadTest.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { expect } from "chai";
33
import readUpload from "../readUpload";
44

55
describe("Test readUpload", () => {
6+
beforeEach(() => {
7+
global.File = window.File;
8+
});
69
it("test read upload", async () => {
7-
document.body.innerHTML = '<input type="file">';
8-
const simFile = new File(["FOO"], "foo.txt");
9-
const fileContent = await readUpload(simFile);
10+
const fakeFile = new File(["FOO"], "foo.txt", { type: "text/plain" });
11+
const fileContent = await readUpload(fakeFile);
1012
expect(fileContent).to.equal("FOO");
1113
});
1214
});

0 commit comments

Comments
 (0)