mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-24 16:56:15 -04:00
add tests for File and test based operations. Only unzip to go
This commit is contained in:
parent
2019ae43d7
commit
b8cb7e9ba8
6 changed files with 76 additions and 7 deletions
20
tests/node/tests/File.mjs
Normal file
20
tests/node/tests/File.mjs
Normal 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");
|
||||
}),
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue