add tests for File and test based operations. Only unzip to go

This commit is contained in:
d98762625 2019-03-14 17:54:06 +00:00
parent 2019ae43d7
commit b8cb7e9ba8
6 changed files with 76 additions and 7 deletions

20
tests/node/tests/File.mjs Normal file
View file

@ -0,0 +1,20 @@
import assert from "assert";
import it from "../assertionHandler";
import TestRegister from "../../lib/TestRegister";
import File from "../../../src/node/File";
TestRegister.addApiTests([
it("File: should exist", () => {
assert(File);
}),
it("File: Should have same properties as DOM File object", () => {
const uint8Array = new Uint8Array(Buffer.from("hello"));
const file = new File([uint8Array], "name.txt");
assert.equal(file.name, "name.txt");
assert(typeof file.lastModified, "number");
assert(file.lastModifiedDate instanceof Date);
assert.equal(file.size, uint8Array.length);
assert.equal(file.type, "text/plain");
}),
]);