|
1 | 1 | import { readFile } from "node:fs/promises";
|
2 | 2 |
|
3 |
| -import { expect, test } from "vitest"; |
| 3 | +import { expect, test, describe } from "vitest"; |
4 | 4 |
|
5 | 5 | import { getUpdatedWebpackChunksFileContent } from "./get-updated-webpack-chunks-file-content";
|
6 | 6 |
|
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 | + }); |
15 | 16 |
|
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 | + }); |
23 | 25 | });
|
0 commit comments