Skip to content

Commit 6a8e37d

Browse files
committed
Add measureLayout mocks
1 parent 58bbef9 commit 6a8e37d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

jestSetup.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,30 @@ jest.mock("@shopify/flash-list", () => {
1414
AnimatedFlashList: MockFlashList,
1515
};
1616
});
17+
18+
jest.mock("@shopify/flash-list/dist/recyclerview/utils/measureLayout", () => {
19+
const originalModule = jest.requireActual(
20+
"@shopify/flash-list/dist/recyclerview/utils/measureLayout"
21+
);
22+
return {
23+
...originalModule,
24+
measureParentSize: jest.fn().mockImplementation(() => ({
25+
x: 0,
26+
y: 0,
27+
width: 400,
28+
height: 900,
29+
})),
30+
measureFirstChildLayout: jest.fn().mockImplementation(() => ({
31+
x: 0,
32+
y: 0,
33+
width: 400,
34+
height: 900,
35+
})),
36+
measureItemLayout: jest.fn().mockImplementation(() => ({
37+
x: 0,
38+
y: 0,
39+
width: 100,
40+
height: 100,
41+
})),
42+
};
43+
});

0 commit comments

Comments
 (0)