@@ -276,4 +276,44 @@ describe("createPrediction()", () => {
276276 input : { text : "test text" } ,
277277 } ) ;
278278 } ) ;
279+
280+ it ( "supports webhook URL" , async ( ) => {
281+ jest . spyOn ( client , "request" ) . mockResolvedValue ( {
282+ id : "testprediction" ,
283+ status : PredictionStatus . SUCCEEDED ,
284+ } ) ;
285+
286+ await model . createPrediction (
287+ { text : "test text" } ,
288+ { webhook : "http://test.host/webhook" }
289+ ) ;
290+
291+ expect ( client . request ) . toHaveBeenCalledWith ( "POST /v1/predictions" , {
292+ version : "testversion" ,
293+ input : { text : "test text" } ,
294+ webhook : "http://test.host/webhook" ,
295+ } ) ;
296+ } ) ;
297+
298+ it ( "supports webhook events filter" , async ( ) => {
299+ jest . spyOn ( client , "request" ) . mockResolvedValue ( {
300+ id : "testprediction" ,
301+ status : PredictionStatus . SUCCEEDED ,
302+ } ) ;
303+
304+ await model . createPrediction (
305+ { text : "test text" } ,
306+ {
307+ webhook : "http://test.host/webhook" ,
308+ webhookEventsFilter : [ "output" , "completed" ] ,
309+ }
310+ ) ;
311+
312+ expect ( client . request ) . toHaveBeenCalledWith ( "POST /v1/predictions" , {
313+ version : "testversion" ,
314+ input : { text : "test text" } ,
315+ webhook : "http://test.host/webhook" ,
316+ webhook_events_filter : [ "output" , "completed" ] ,
317+ } ) ;
318+ } ) ;
279319} ) ;
0 commit comments