File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ class Webhooks {
23
23
} )
24
24
}
25
25
26
+ list ( { uid } = { } ) {
27
+ return this . _http . request ( {
28
+ method : 'get' ,
29
+ url : `/forms/${ uid } /webhooks`
30
+ } )
31
+ }
32
+
26
33
update ( args ) {
27
34
return createOrUpdateWebhook ( this . _http , args )
28
35
}
Original file line number Diff line number Diff line change @@ -13,12 +13,6 @@ const http = clientConstructor({
13
13
} )
14
14
const webhooksRequest = webhooks ( http )
15
15
16
- test ( 'List webhooks has the correct path and method' , ( ) => {
17
- webhooksRequest . get ( { uid : 2 , tag : 'test' } )
18
- expect ( fetch . mock . calls [ 0 ] [ 1 ] . method ) . toBe ( 'get' )
19
- expect ( fetch . mock . calls [ 0 ] [ 0 ] ) . toBe ( `${ API_BASE_URL } /forms/2/webhooks/test` )
20
- } )
21
-
22
16
test ( 'Create a new webhooks has the correct path, method and url' , ( ) => {
23
17
webhooksRequest . create ( {
24
18
uid : 2 ,
@@ -37,6 +31,18 @@ test('Create a new webhooks requires a url', () => {
37
31
expect ( ( ) => webhooksRequest . create ( { uid : 2 , tag : 'test' } ) ) . toThrow ( )
38
32
} )
39
33
34
+ test ( '`get()` webhooks has the correct path and method' , ( ) => {
35
+ webhooksRequest . get ( { uid : 2 , tag : 'test' } )
36
+ expect ( fetch . mock . calls [ 0 ] [ 1 ] . method ) . toBe ( 'get' )
37
+ expect ( fetch . mock . calls [ 0 ] [ 0 ] ) . toBe ( `${ API_BASE_URL } /forms/2/webhooks/test` )
38
+ } )
39
+
40
+ test ( '`list()` webhooks has the correct path and method' , ( ) => {
41
+ webhooksRequest . list ( { uid : 2 } )
42
+ expect ( fetch . mock . calls [ 0 ] [ 1 ] . method ) . toBe ( 'get' )
43
+ expect ( fetch . mock . calls [ 0 ] [ 0 ] ) . toBe ( `${ API_BASE_URL } /forms/2/webhooks` )
44
+ } )
45
+
40
46
test ( 'update a new webhooks sends the correct payload' , ( ) => {
41
47
webhooksRequest . update ( {
42
48
uid : 2 ,
You can’t perform that action at this time.
0 commit comments