Skip to content

Commit 5a90513

Browse files
fixup! implement webpack chunks file updating using ast manipulation
add missing describe block
1 parent bc52302 commit 5a90513

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed
Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import { readFile } from "node:fs/promises";
22

3-
import { expect, test } from "vitest";
3+
import { expect, test, describe } from "vitest";
44

55
import { getUpdatedWebpackChunksFileContent } from "./get-updated-webpack-chunks-file-content";
66

7-
test("works as expected on unminified code", async () => {
8-
const fileContent = await readFile(
9-
`${import.meta.dirname}/test-fixtures/unminified-webpacks-file.js`,
10-
"utf8"
11-
);
12-
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
13-
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/unminified-webpacks-file.js");
14-
});
7+
describe("getUpdatedWebpackChunksFileContent", () => {
8+
test("works as expected on unminified code", async () => {
9+
const fileContent = await readFile(
10+
`${import.meta.dirname}/test-fixtures/unminified-webpacks-file.js`,
11+
"utf8"
12+
);
13+
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
14+
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/unminified-webpacks-file.js");
15+
});
1516

16-
test("works as expected on minified code", async () => {
17-
const fileContent = await readFile(
18-
`${import.meta.dirname}/test-fixtures/minified-webpacks-file.js`,
19-
"utf8"
20-
);
21-
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
22-
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/minified-webpacks-file.js");
17+
test("works as expected on minified code", async () => {
18+
const fileContent = await readFile(
19+
`${import.meta.dirname}/test-fixtures/minified-webpacks-file.js`,
20+
"utf8"
21+
);
22+
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
23+
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/minified-webpacks-file.js");
24+
});
2325
});

0 commit comments

Comments
 (0)