@@ -49,7 +49,6 @@ describe('usePredictionsQuery', (): void => {
4949
5050 beforeEach ( ( ) => {
5151 mockedInferenceService . getPredictions = jest . fn ( ) ;
52- mockedInferenceService . getExplanations = jest . fn ( ) ;
5352 } ) ;
5453
5554 it ( 'task-chain projects call the service with taskId ' , async ( ) : Promise < void > => {
@@ -69,15 +68,6 @@ describe('usePredictionsQuery', (): void => {
6968 expect ( result . current ) . toBeDefined ( ) ;
7069 } ) ;
7170
72- expect ( mockedInferenceService . getExplanations ) . toHaveBeenCalledWith (
73- datasetIdentifier ,
74- mediaItem ,
75- taskId ,
76- undefined ,
77-
78- // AbortController
79- expect . anything ( )
80- ) ;
8171 expect ( mockedInferenceService . getPredictions ) . toHaveBeenCalledWith (
8272 datasetIdentifier ,
8373 coreLabels ,
@@ -97,7 +87,6 @@ describe('usePredictionsQuery', (): void => {
9787 } ) ;
9888
9989 await waitFor ( ( ) => {
100- expect ( mockedInferenceService . getExplanations ) . not . toHaveBeenCalled ( ) ;
10190 expect ( mockedInferenceService . getPredictions ) . toHaveBeenCalledWith (
10291 datasetIdentifier ,
10392 coreLabels ,
@@ -111,7 +100,7 @@ describe('usePredictionsQuery', (): void => {
111100 } ) ;
112101 } ) ;
113102
114- it ( 'PredictionMode LATEST is handle as PredictionCache.ALWAYS' , async ( ) : Promise < void > => {
103+ it ( 'PredictionMode LATEST is handled as PredictionCache.ALWAYS' , async ( ) : Promise < void > => {
115104 const onSuccess = jest . fn ( ) ;
116105
117106 renderHookWithProviders (
@@ -126,7 +115,6 @@ describe('usePredictionsQuery', (): void => {
126115 expect ( onSuccess ) . toHaveBeenCalled ( ) ;
127116 } ) ;
128117
129- expect ( mockedInferenceService . getExplanations ) . not . toHaveBeenCalled ( ) ;
130118 expect ( mockedInferenceService . getPredictions ) . toHaveBeenCalledWith (
131119 datasetIdentifier ,
132120 coreLabels ,
@@ -139,24 +127,19 @@ describe('usePredictionsQuery', (): void => {
139127 ) ;
140128 } ) ;
141129
142- it ( 'PredictionMode.ONLINE is sent as PredictionCache.NEVER, getExplanations is called' , async ( ) : Promise < void > => {
130+ it ( 'PredictionMode.ONLINE is handled as PredictionCache.NEVER' , async ( ) : Promise < void > => {
131+ const onSuccess = jest . fn ( ) ;
132+
143133 renderHookWithProviders (
144- ( ) => usePredictionsQuery ( { ...predictionArguments , predictionId : PredictionMode . ONLINE } ) ,
134+ ( ) => usePredictionsQuery ( { ...predictionArguments , onSuccess , predictionId : PredictionMode . ONLINE } ) ,
145135 {
146136 wrapper,
147137 providerProps : { ...initialProps } ,
148138 }
149139 ) ;
150140
151141 await waitFor ( ( ) => {
152- expect ( mockedInferenceService . getExplanations ) . toHaveBeenCalledWith (
153- datasetIdentifier ,
154- mediaItem ,
155- undefined ,
156- undefined ,
157- // AbortController
158- expect . anything ( )
159- ) ;
142+ expect ( onSuccess ) . toHaveBeenCalled ( ) ;
160143 } ) ;
161144
162145 expect ( mockedInferenceService . getPredictions ) . toHaveBeenCalledWith (
@@ -170,25 +153,4 @@ describe('usePredictionsQuery', (): void => {
170153 expect . anything ( )
171154 ) ;
172155 } ) ;
173-
174- it ( 'does not call "getExplanations" for keypoint detection projects' , async ( ) : Promise < void > => {
175- const mockedProjectService = createInMemoryProjectService ( ) ;
176-
177- mockedProjectService . getProject = async ( ) =>
178- getMockedProject ( { tasks : [ getMockedTask ( { domain : DOMAIN . KEYPOINT_DETECTION } ) ] } ) ;
179-
180- renderHookWithProviders (
181- ( ) => usePredictionsQuery ( { ...predictionArguments , predictionId : PredictionMode . ONLINE } ) ,
182- {
183- wrapper,
184- providerProps : { ...initialProps , projectService : mockedProjectService } ,
185- }
186- ) ;
187-
188- await waitFor ( ( ) => {
189- expect ( mockedInferenceService . getPredictions ) . toHaveBeenCalled ( ) ;
190- } ) ;
191-
192- expect ( mockedInferenceService . getExplanations ) . not . toHaveBeenCalled ( ) ;
193- } ) ;
194156} ) ;
0 commit comments