-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
_util_test.ts
46 lines (45 loc) · 1.17 KB
/
_util_test.ts
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
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts";
import { hasDefaultExport } from "./_util.ts";
const { test } = Deno;
test("hasDefaultExport", () => {
for (
const { want, input } of [
{
want: true,
input: `export default from "https://deno.land/foo/bar.ts"`,
},
{
want: true,
input: `export { default } from "https://deno.land/foo/bar.ts"`,
},
{
want: true,
input: `export{default}from "https://deno.land/foo/bar.ts"`,
},
{
want: false,
input:
`export { assert } from "https://deno.land/std/testing/asserts.ts"`,
},
{
want: true,
input: `export { foo, default } from "https://deno.land/foo/bar.ts"`,
},
{
want: false,
input: `export { defaultValue } from "https://deno.land/foo/bar.ts"`,
},
{
want: true,
input: `export { bar as default } from "https://deno.land/foo/bar.ts"`,
},
]
) {
const got = hasDefaultExport(input);
assertEquals(
got,
want,
`Given "${input}", hasDefaultExport should return ${want}`,
);
}
});