Skip to content

Commit

Permalink
refactor: avoid useless asignantions in tests files
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-michelet committed Apr 12, 2024
1 parent 23a6487 commit 736d488
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/EntryFilesAnalyser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ describe("EntryFilesAnalyser", () => {
const entryFilesAnalyser = new EntryFilesAnalyser();
const entryUrl = new URL("entry.js", FIXTURE_URL);
const deepEntryUrl = new URL("deps/deepEntry.js", FIXTURE_URL);
const entryFiles = [entryUrl, deepEntryUrl];

t.mock.method(AstAnalyser.prototype, "analyseFile");
const generator = entryFilesAnalyser.analyse(entryFiles);
const generator = entryFilesAnalyser.analyse([entryUrl, deepEntryUrl]);

// First entry
await assertReport(generator, entryUrl, true);
await assertReport(generator, new URL("deps/dep1.js", FIXTURE_URL), true);
await assertReport(generator, new URL("shared.js", FIXTURE_URL), true);
await assertReport(generator, new URL("deps/dep2.js", FIXTURE_URL), true);

// Second entry
await assertReport(generator, deepEntryUrl, true);
await assertReport(generator, new URL("deps/dep3.js", FIXTURE_URL), true);

Expand All @@ -33,9 +35,8 @@ describe("EntryFilesAnalyser", () => {
it("should detect internal deps that failed to be analyzed", async() => {
const entryFilesAnalyser = new EntryFilesAnalyser();
const entryUrl = new URL("entryWithInvalidDep.js", FIXTURE_URL);
const entryFiles = [entryUrl];

const generator = entryFilesAnalyser.analyse(entryFiles);
const generator = entryFilesAnalyser.analyse([entryUrl]);

await assertReport(generator, entryUrl, true);

Expand Down

0 comments on commit 736d488

Please sign in to comment.