Skip to content

Commit 6f6c12c

Browse files
author
Mohsen Azimi
committed
Add test (I have no idea what I am doing)
1 parent 8001f03 commit 6f6c12c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/dependencies/HarmonyExportImportedSpecifierDependency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
553553
if (activeExports.size > 0)
554554
content +=
555555
"if(" +
556-
JSON.stringify(Array.from(activeExports.add("default"))) +
556+
JSON.stringify(Array.from(activeExports).concat("default")) +
557557
".indexOf(__WEBPACK_IMPORT_KEY__) < 0) ";
558558
else content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
559559
const exportsName = dep.originModule.exportsArgument;

test/HarmonyExportImportedSpecifierDependency.unittest.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,24 @@ describe("HarmonyExportImportedSpecifierDependency", () => {
1313
should(instance.getHashValue(null)).be.eql("");
1414
});
1515
});
16+
describe("getContent", () => {
17+
describe("dynamic-reexport mode", () => {
18+
it("should generate proper content", () => {
19+
const instance = new HarmonyExportImportedSpecifierDependency();
20+
const dep = {
21+
activeExports: ["module.exports = 1 //?"],
22+
originModule: {
23+
exportsArgument: "ClassName"
24+
},
25+
_discoverActiveExportsFromOtherStartExports() {
26+
return [];
27+
},
28+
getMode() {
29+
return "dynamic-reexport";
30+
}
31+
};
32+
should(instance.getContent(dep)).to.eql("???");
33+
});
34+
});
35+
});
1636
});

0 commit comments

Comments
 (0)