Skip to content

Commit 19cc7d3

Browse files
committed
test fixes
1 parent 9b3388e commit 19cc7d3

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

app/src/organisms/ErrorRecoveryFlows/__fixtures__/index.ts

+8
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,12 @@ export const mockRecoveryContentProps: RecoveryContentProps = {
8181
mockRobotSideAnalysis.commands[mockRobotSideAnalysis.commands.length - 1],
8282
],
8383
recoveryActionMutationUtils: {} as any,
84+
analytics: {
85+
reportRecoveredRunResult: () => {},
86+
reportErrorEvent: () => {},
87+
reportViewErrorDetailsEvent: () => {},
88+
reportActionSelectedEvent: () => {},
89+
reportInitialActionEvent: () => {},
90+
reportActionSelectedResult: () => {},
91+
},
8492
}

app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
useCurrentlyRecoveringFrom,
1717
useERUtils,
1818
useShowDoorInfo,
19+
useRecoveryAnalytics,
1920
} from '../hooks'
2021
import { useFeatureFlag } from '../../../redux/config'
2122
import { useERWizard, ErrorRecoveryWizard } from '../ErrorRecoveryWizard'
@@ -144,6 +145,9 @@ describe('ErrorRecovery', () => {
144145
vi.mocked(useRunPausedSplash).mockReturnValue(true)
145146
vi.mocked(useERUtils).mockReturnValue({ routeUpdateActions: {} } as any)
146147
vi.mocked(useShowDoorInfo).mockReturnValue(false)
148+
vi.mocked(useRecoveryAnalytics).mockReturnValue({
149+
reportErrorEvent: vi.fn(),
150+
} as any)
147151
})
148152

149153
it('renders the wizard when the wizard is toggled on', () => {

app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ describe('useRecoveryCommands', () => {
6060
failedLabwareUtils: mockFailedLabwareUtils,
6161
routeUpdateActions: mockRouteUpdateActions,
6262
recoveryToastUtils: {} as any,
63+
analytics: { reportRecoveredRunResult: vi.fn() } as any,
64+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
6365
})
6466
)
6567

@@ -86,6 +88,8 @@ describe('useRecoveryCommands', () => {
8688
failedLabwareUtils: mockFailedLabwareUtils,
8789
routeUpdateActions: mockRouteUpdateActions,
8890
recoveryToastUtils: {} as any,
91+
analytics: { reportActionSelectedResult: vi.fn() } as any,
92+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
8993
})
9094
)
9195

@@ -113,6 +117,8 @@ describe('useRecoveryCommands', () => {
113117
failedLabwareUtils: mockFailedLabwareUtils,
114118
routeUpdateActions: mockRouteUpdateActions,
115119
recoveryToastUtils: {} as any,
120+
analytics: { reportRecoveredRunResult: vi.fn() } as any,
121+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
116122
})
117123
)
118124

@@ -134,7 +140,9 @@ describe('useRecoveryCommands', () => {
134140
failedLabwareUtils: mockFailedLabwareUtils,
135141
routeUpdateActions: mockRouteUpdateActions,
136142
recoveryToastUtils: { makeSuccessToast: mockMakeSuccessToast } as any,
137-
})
143+
analytics: { reportActionSelectedResult: vi.fn() } as any,
144+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
145+
} as any)
138146
)
139147

140148
await act(async () => {
@@ -153,6 +161,8 @@ describe('useRecoveryCommands', () => {
153161
failedLabwareUtils: mockFailedLabwareUtils,
154162
routeUpdateActions: mockRouteUpdateActions,
155163
recoveryToastUtils: {} as any,
164+
analytics: { reportActionSelectedResult: vi.fn() } as any,
165+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
156166
})
157167
)
158168

@@ -169,6 +179,8 @@ describe('useRecoveryCommands', () => {
169179
failedLabwareUtils: mockFailedLabwareUtils,
170180
routeUpdateActions: mockRouteUpdateActions,
171181
recoveryToastUtils: {} as any,
182+
analytics: { reportActionSelectedResult: vi.fn() } as any,
183+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
172184
})
173185
)
174186

@@ -208,6 +220,8 @@ describe('useRecoveryCommands', () => {
208220
},
209221
routeUpdateActions: mockRouteUpdateActions,
210222
recoveryToastUtils: {} as any,
223+
analytics: { reportActionSelectedResult: vi.fn() } as any,
224+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
211225
})
212226
)
213227

@@ -229,6 +243,8 @@ describe('useRecoveryCommands', () => {
229243
failedLabwareUtils: mockFailedLabwareUtils,
230244
routeUpdateActions: mockRouteUpdateActions,
231245
recoveryToastUtils: { makeSuccessToast: mockMakeSuccessToast } as any,
246+
analytics: { reportActionSelectedResult: vi.fn() } as any,
247+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
232248
})
233249
)
234250

@@ -248,6 +264,8 @@ describe('useRecoveryCommands', () => {
248264
failedLabwareUtils: mockFailedLabwareUtils,
249265
routeUpdateActions: mockRouteUpdateActions,
250266
recoveryToastUtils: {} as any,
267+
analytics: { reportActionSelectedResult: vi.fn() } as any,
268+
selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE,
251269
})
252270
)
253271

app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryAnalytics.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as React from 'react'
2-
31
import { RUN_STATUS_FAILED, RUN_STATUS_SUCCEEDED } from '@opentrons/api-client'
42

53
import {

0 commit comments

Comments
 (0)