Skip to content

Commit d09d491

Browse files
fix: address review comments on PR #44324
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ef9d1eb commit d09d491

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

ui/pages/perps/perps-market-detail-page.test.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,19 @@ jest.mock('../../hooks/perps', () => ({
266266
usePerpsMarketFills: (...args: unknown[]) => mockUsePerpsMarketFills(...args),
267267
usePerpsMarketInfo: jest.fn(),
268268
}));
269+
// Cancel/close/reverse/TP-SL modals call usePerpsAttribution; keep them
270+
// renderable without mounting PerpsAttributionProvider in this page suite.
271+
jest.mock('../../hooks/perps/usePerpsAttribution', () => ({
272+
usePerpsAttribution: () => ({
273+
buildTrackingData: (input: Record<string, unknown>) => ({
274+
...input,
275+
entryPoint: 'homescreen_tab',
276+
discoverySource: 'market_list',
277+
}),
278+
buildTpslTrackingData: (input: Record<string, unknown>) => input,
279+
setFlowAttribution: jest.fn(),
280+
}),
281+
}));
269282
jest.mock(
270283
'../../components/app/perps/hooks/usePerpsDepositConfirmation',
271284
() => ({
@@ -1845,7 +1858,16 @@ describe('PerpsMarketDetailPage', () => {
18451858
await waitFor(() => {
18461859
expect(mockSubmitRequestToBackground).toHaveBeenCalledWith(
18471860
'perpsCancelOrder',
1848-
[{ orderId: 'order-001', symbol: 'ETH' }],
1861+
[
1862+
expect.objectContaining({
1863+
orderId: 'order-001',
1864+
symbol: 'ETH',
1865+
trackingData: expect.objectContaining({
1866+
entryPoint: 'homescreen_tab',
1867+
discoverySource: 'market_list',
1868+
}),
1869+
}),
1870+
],
18491871
);
18501872
});
18511873
});

0 commit comments

Comments
 (0)