Skip to content

Commit

Permalink
fixup! implement webpack chunks file updating using ast manipulation
Browse files Browse the repository at this point in the history
add missing describe block
  • Loading branch information
dario-piotrowicz committed Sep 20, 2024
1 parent bc52302 commit 5a90513
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { readFile } from "node:fs/promises";

import { expect, test } from "vitest";
import { expect, test, describe } from "vitest";

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

test("works as expected on unminified code", async () => {
const fileContent = await readFile(
`${import.meta.dirname}/test-fixtures/unminified-webpacks-file.js`,
"utf8"
);
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/unminified-webpacks-file.js");
});
describe("getUpdatedWebpackChunksFileContent", () => {
test("works as expected on unminified code", async () => {
const fileContent = await readFile(
`${import.meta.dirname}/test-fixtures/unminified-webpacks-file.js`,
"utf8"
);
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/unminified-webpacks-file.js");
});

test("works as expected on minified code", async () => {
const fileContent = await readFile(
`${import.meta.dirname}/test-fixtures/minified-webpacks-file.js`,
"utf8"
);
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/minified-webpacks-file.js");
test("works as expected on minified code", async () => {
const fileContent = await readFile(
`${import.meta.dirname}/test-fixtures/minified-webpacks-file.js`,
"utf8"
);
const updatedContent = await getUpdatedWebpackChunksFileContent(fileContent, ["658"]);
expect(updatedContent).toMatchFileSnapshot("./test-snapshots/minified-webpacks-file.js");
});
});

0 comments on commit 5a90513

Please sign in to comment.