@@ -11,40 +11,50 @@ const baseUrl = 'http://localhost:3030'
11
11
12
12
// These are fixtures used in the service-modulet.test.js under socket events.
13
13
let id = 0
14
- mockServer . on ( 'things::create' , function ( data ) {
14
+ mockServer . on ( 'things::create' , function ( data , params , cb ) {
15
15
data . id = id
16
16
id ++
17
17
mockServer . emit ( 'things created' , data )
18
+ cb ( null , data )
18
19
} )
19
- mockServer . on ( 'things::patch' , function ( id , data ) {
20
+ mockServer . on ( 'things::patch' , function ( id , data , params , cb ) {
20
21
Object . assign ( data , { id, test : true } )
21
22
mockServer . emit ( 'things patched' , data )
23
+ cb ( null , data )
22
24
} )
23
- mockServer . on ( 'things::update' , function ( id , data ) {
25
+ mockServer . on ( 'things::update' , function ( id , data , params , cb ) {
24
26
Object . assign ( data , { id, test : true } )
25
27
mockServer . emit ( 'things updated' , data )
28
+ cb ( null , data )
26
29
} )
27
- mockServer . on ( 'things::remove' , function ( id ) {
28
- mockServer . emit ( 'things removed' , { id, test : true } )
30
+ mockServer . on ( 'things::remove' , function ( id , obj , cb ) {
31
+ const response = { id, test : true }
32
+ mockServer . emit ( 'things removed' , response )
33
+ cb ( null , response )
29
34
} )
30
35
31
36
let idDebounce = 0
32
37
33
- mockServer . on ( 'things-debounced::create' , function ( data ) {
38
+ mockServer . on ( 'things-debounced::create' , function ( data , obj , cb ) {
34
39
data . id = idDebounce
35
40
idDebounce ++
36
41
mockServer . emit ( 'things-debounced created' , data )
42
+ cb ( null , data )
37
43
} )
38
- mockServer . on ( 'things-debounced::patch' , function ( id , data ) {
44
+ mockServer . on ( 'things-debounced::patch' , function ( id , data , params , cb ) {
39
45
Object . assign ( data , { id, test : true } )
40
46
mockServer . emit ( 'things-debounced patched' , data )
47
+ cb ( null , data )
41
48
} )
42
- mockServer . on ( 'things-debounced::update' , function ( id , data ) {
49
+ mockServer . on ( 'things-debounced::update' , function ( id , data , params , cb ) {
43
50
Object . assign ( data , { id, test : true } )
44
51
mockServer . emit ( 'things-debounced updated' , data )
52
+ cb ( null , data )
45
53
} )
46
- mockServer . on ( 'things-debounced::remove' , function ( id ) {
47
- mockServer . emit ( 'things-debounced removed' , { id, test : true } )
54
+ mockServer . on ( 'things-debounced::remove' , function ( id , params , cb ) {
55
+ const response = { id, test : true }
56
+ mockServer . emit ( 'things-debounced removed' , response )
57
+ cb ( null , response )
48
58
} )
49
59
50
60
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
0 commit comments