Skip to content

Commit 1a6127d

Browse files
authored
test: cover a chunk group that grows and finds a new block in one connect batch (#22678)
1 parent 3c75150 commit 1a6127d

11 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default "a";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default "b";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import a from "./a";
2+
import b from "./b";
3+
4+
export default [a, b];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default "d";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import a from "./a";
2+
3+
it("should load a into c after p loses it", async () => {
4+
expect(a).toBe("a");
5+
const p1 = await import(/* webpackChunkName: "p" */ "./p1");
6+
const c = await p1.loadC();
7+
expect(c.default).toEqual(["a", "b"]);
8+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
it("should load d from the block found when p grows", async () => {
2+
const q = await import("./q");
3+
const p2 = await q.loadP2();
4+
expect(p2.default).toBe("b");
5+
expect((await p2.loadD()).default).toBe("d");
6+
expect((await p2.loadC()).default).toEqual(["a", "b"]);
7+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const loadC = () => import(/* webpackChunkName: "c" */ "./c");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default } from "./b";
2+
export const loadC = () => import(/* webpackChunkName: "c" */ "./c");
3+
export const loadD = () => import(/* webpackChunkName: "d" */ "./d");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const loadP2 = () => import(/* webpackChunkName: "p" */ "./p2");
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strict";
2+
3+
module.exports = {
4+
findBundle() {
5+
return ["main.js", "other.js"];
6+
}
7+
};

0 commit comments

Comments
 (0)