Skip to content

Commit d5f9ed8

Browse files
committed
test: enhance tests to include binary import handling and update error case
1 parent a60fee4 commit d5f9ed8

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/__tests__/index.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ describe("Raw plugin", () => {
3030
const fileContent = fs.readFileSync(path.resolve(__dirname, "../src/index.ts"));
3131
// @ts-ignore
3232
const generatedCodeContent = (await import("./dist/test1.js")).getText();
33+
// @ts-ignore
34+
const generatedCodeContent2 = (await import("./dist/test1.js")).getText2();
3335
expect(generatedCodeContent).toBe(fileContent.toString("base64"));
36+
expect(generatedCodeContent2.toString("base64")).toBe(fileContent.toString("base64"));
3437
});
3538

3639
test("throws error if no file is found", async ({ expect }) => {

lib/__tests__/test1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// test auto complete
22

33
import text from "../src?base64";
4+
import text2 from "../src?binary";
45

56
export const getText = () => text;
7+
export const getText2 = () => text2;

lib/__tests__/test2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// test auto error
22

3-
import text from "../src/my-file?raw";
3+
import text from "../src/my-file?buffer";
44

55
export const getText = () => text;

0 commit comments

Comments
 (0)