-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathisExtractableFile.test.mjs
More file actions
52 lines (41 loc) · 1.1 KB
/
Copy pathisExtractableFile.test.mjs
File metadata and controls
52 lines (41 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// @ts-check
import { strictEqual } from "node:assert";
import { suite, test } from "node:test";
import revertableGlobals from "revertable-globals";
import isExtractableFile from "./isExtractableFile.mjs";
import assertBundleSize from "./test-helpers/assertBundleSize.mjs";
suite(
"Function `isExtractableFile`.",
{
concurrency: true,
},
() => {
test("Bundle size.", async () => {
await assertBundleSize(
new URL("./isExtractableFile.mjs", import.meta.url),
120,
);
});
test("With a `File` instance.", () => {
class File {}
const revertGlobals = revertableGlobals({ File });
try {
strictEqual(isExtractableFile(new File()), true);
} finally {
revertGlobals();
}
});
test("With a `Blob` instance.", () => {
class Blob {}
const revertGlobals = revertableGlobals({ Blob });
try {
strictEqual(isExtractableFile(new Blob()), true);
} finally {
revertGlobals();
}
});
test("With a non-file.", () => {
strictEqual(isExtractableFile({}), false);
});
},
);