Skip to content

Commit 9093861

Browse files
committed
[INTERNAL] ResourceCollector: Fix existing tests
1 parent 44665bb commit 9093861

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

test/lib/lbt/resources/ResourceCollector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ test.serial("determineResourceDetails: view.xml", async (t) => {
119119
await resourceCollector.visitResource({getPath: () => "/resources/mylib/my.view.xml", getSize: async () => 13});
120120
await resourceCollector.determineResourceDetails({});
121121
t.is(enrichWithDependencyInfoStub.callCount, 1, "is called once");
122-
t.is(enrichWithDependencyInfoStub.getCall(0).args[0].name, "mylib/my.view.xml", "is called with view");
122+
t.is(enrichWithDependencyInfoStub.getCall(0).args[0].resourceInfo.name, "mylib/my.view.xml", "is called with view");
123123
});
124124

125125
test.serial("enrichWithDependencyInfo: add infos to resourceinfo", async (t) => {
@@ -147,7 +147,7 @@ test.serial("enrichWithDependencyInfo: add infos to resourceinfo", async (t) =>
147147
}
148148
});
149149
const resourceInfo = {};
150-
await resourceCollector.enrichWithDependencyInfo(resourceInfo);
150+
await resourceCollector.enrichWithDependencyInfo({resourceInfo});
151151
t.deepEqual(resourceInfo, {
152152
condRequired: new Set(["mydependency.conditional"]),
153153
dynRequired: true,

test/lib/lbt/resources/ResourceInfoList.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,28 @@ test("add: add new resources", (t) => {
1616
t.falsy(result.module, "module is not set");
1717
});
1818

19-
test("add: add source then debug resources", (t) => {
19+
test("add: add non-debug resource", (t) => {
2020
const resourceInfoList = new ResourceInfoList("prefix");
2121

22-
resourceInfoList.add({name: "myfile.js", module: "myfile.js", size: 13});
22+
resourceInfoList.add({name: "myfile.js", module: "myfile.js", size: 13, required: new Set(["some-dep.js"])});
2323

24-
const myInfo = {name: "myfile-dbg.js", size: 13};
25-
resourceInfoList.add(myInfo);
26-
27-
t.is(resourceInfoList.resources.length, 2, "two entries");
24+
t.is(resourceInfoList.resources.length, 1, "one resource added");
2825

2926
const result = resourceInfoList.resourcesByName.get("../myfile.js");
3027
t.is(result.module, "myfile.js", "module is set");
31-
32-
const resultDbg = resourceInfoList.resourcesByName.get("../myfile-dbg.js");
33-
t.is(resultDbg.module, "myfile.js", "module is set");
28+
t.deepEqual(result.required, new Set(["some-dep.js"]), "module is set");
3429
});
3530

36-
test("add: add debug then source resources", (t) => {
31+
test("add: add debug resources", (t) => {
3732
const resourceInfoList = new ResourceInfoList("prefix");
3833

39-
resourceInfoList.add({name: "myfile-dbg.js", size: 13});
34+
resourceInfoList.add({name: "myfile-dbg.js", size: 13, required: new Set(["some-dep.js"])});
4035

41-
const myInfo = {name: "myfile.js", module: "myfile.js", size: 13};
42-
resourceInfoList.add(myInfo);
43-
44-
t.is(resourceInfoList.resources.length, 2, "two entries");
45-
46-
const result = resourceInfoList.resourcesByName.get("../myfile.js");
47-
t.is(result.module, "myfile.js", "module is set");
36+
t.is(resourceInfoList.resources.length, 1, "one resource added");
4837

4938
const resultDbg = resourceInfoList.resourcesByName.get("../myfile-dbg.js");
5039
t.is(resultDbg.module, "myfile.js", "module is set");
40+
t.deepEqual(resultDbg.required, new Set(["some-dep.js"]), "module is set");
5141
});
5242

5343
test("add: add i18n resource", (t) => {

0 commit comments

Comments
 (0)