From 2322b1de4d2467d63311fbeaa82b64546fdd9029 Mon Sep 17 00:00:00 2001 From: Lachlan Heywood Date: Tue, 26 Nov 2024 12:16:12 -0500 Subject: [PATCH] fix: add test for named export in fresh module --- .../src/__tests__/moduleUtils.test.ts | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/docusaurus-utils/src/__tests__/moduleUtils.test.ts b/packages/docusaurus-utils/src/__tests__/moduleUtils.test.ts index 653667292a9a..dd0c8bf5c3c0 100644 --- a/packages/docusaurus-utils/src/__tests__/moduleUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/moduleUtils.test.ts @@ -122,8 +122,10 @@ describe('loadFreshModule', () => { import dependency1 from "./dependency1"; import dependency2 from "./dependency2"; + export const entryValue = "entryVal1"; + export default { - someEntryValue: "entryVal", + someEntryValue: "entryVal2", dependency1, dependency2 }; @@ -132,7 +134,8 @@ describe('loadFreshModule', () => { // Should be able to read the initial module graph await expect(entryFile.load()).resolves.toEqual({ - someEntryValue: 'entryVal', + entryValue: 'entryVal1', + someEntryValue: 'entryVal2', dependency1: { dep1Export: 'dep1 val1', dep1Val: 'dep1 val2', @@ -159,7 +162,8 @@ describe('loadFreshModule', () => { `, ); await expect(entryFile.load()).resolves.toEqual({ - someEntryValue: 'entryVal', + entryValue: 'entryVal1', + someEntryValue: 'entryVal2', dependency1: { dep1Export: 'dep1 val1 updated', dep1Val: 'dep1 val2 updated', @@ -184,7 +188,8 @@ describe('loadFreshModule', () => { `, ); await expect(entryFile.load()).resolves.toEqual({ - someEntryValue: 'entryVal', + entryValue: 'entryVal1', + someEntryValue: 'entryVal2', dependency1: { dep1Export: 'dep1 val1 updated', dep1Val: 'dep1 val2 updated', @@ -208,8 +213,10 @@ describe('loadFreshModule', () => { import dependency1 from "./dependency1"; import dependency2 from "./dependency2"; + export const entryValue = "entryVal1 updated"; + export default { - someEntryValue: "entryVal updated", + someEntryValue: "entryVal2 updated", dependency1, dependency2, newAttribute: "is there" @@ -217,7 +224,8 @@ describe('loadFreshModule', () => { `, ); await expect(entryFile.load()).resolves.toEqual({ - someEntryValue: 'entryVal updated', + entryValue: 'entryVal1 updated', + someEntryValue: 'entryVal2 updated', newAttribute: 'is there', dependency1: { dep1Export: 'dep1 val1 updated',