-
Notifications
You must be signed in to change notification settings - Fork 1
/
mod_test.ts
40 lines (33 loc) · 922 Bytes
/
mod_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
import { assert } from "https://deno.land/std@0.144.0/testing/asserts.ts";
import { transform } from "./mod.ts";
Deno.test("swc", async (t) => {
await t.step("ts", async () => {
const ret = await transform(
"./mod.ts",
await Deno.readTextFile("./mod.ts"),
);
assert(ret.code.includes(`function transform(`));
});
await t.step("jsx", async () => {
const ret = await transform(
"./app.jsx",
`
import React from "https://esm.sh/react";
export default function App() {
return <h1>Hello world!</h1>
}
`,
{
isDev: true,
},
);
assert(ret.code.includes(`React.createElement("h1"`));
});
await t.step("js", async () => {
const ret = await transform(
"./gsi-client.js",
await Deno.readTextFile("./testdata/gsi-client.js"),
);
assert(ret.code.includes(`this.default_gsi`));
});
});