@@ -24,7 +24,7 @@ const MOCK_PENDING_REQUESTS = [
2424 invitationId : MOCK_REQUEST_ID ,
2525 } ,
2626] ;
27- const MOCK_ACCEPT_REQUESTS = { } ;
27+ const MOCK_EMPTY_RESPONSE = { } ;
2828
2929// Contains all tests which require a mocked Senseserver
3030describe ( 'Tests on niceday-api server using mocked goalie-js' , ( ) => {
@@ -53,7 +53,10 @@ describe('Tests on niceday-api server using mocked goalie-js', () => {
5353 resolve ( MOCK_PENDING_REQUESTS ) ;
5454 } ) ,
5555 acceptInvitation : ( ) => new Promise ( ( resolve ) => {
56- resolve ( MOCK_ACCEPT_REQUESTS ) ;
56+ resolve ( MOCK_EMPTY_RESPONSE ) ;
57+ } ) ,
58+ removeContactFromUserContact : ( ) => new Promise ( ( resolve ) => {
59+ resolve ( MOCK_EMPTY_RESPONSE ) ;
5760 } ) ,
5861 } ) ) ,
5962 Authentication : jest . fn ( ) . mockImplementation ( ( ) => ( {
@@ -234,7 +237,30 @@ describe('Tests on niceday-api server using mocked goalie-js', () => {
234237 } )
235238 . then ( ( response ) => response . json ( ) )
236239 . then ( ( responseBody ) => {
237- expect ( responseBody ) . toEqual ( MOCK_ACCEPT_REQUESTS ) ;
240+ expect ( responseBody ) . toEqual ( MOCK_EMPTY_RESPONSE ) ;
241+ } )
242+ . catch ( ( error ) => {
243+ throw new Error ( `Error during fetch: ${ error } ` ) ;
244+ } ) ;
245+ } ) ;
246+
247+ it ( 'Test remove contact /removecontact endpoint' , ( ) => {
248+ /*
249+ Sends a POST to the /acceptconnection endpoint.
250+ */
251+
252+ const urlreq = `http://localhost:${ NICEDAY_TEST_SERVERPORT } /removecontact` ;
253+ const data = JSON . stringify ( {
254+ user_id : NICEDAY_TEST_USER_ID . toString ( ) ,
255+ } ) ;
256+ return fetch ( urlreq , {
257+ method : 'post' ,
258+ headers : { 'Content-Type' : 'application/json' } ,
259+ body : data ,
260+ } )
261+ . then ( ( response ) => response . json ( ) )
262+ . then ( ( responseBody ) => {
263+ expect ( responseBody ) . toEqual ( MOCK_EMPTY_RESPONSE ) ;
238264 } )
239265 . catch ( ( error ) => {
240266 throw new Error ( `Error during fetch: ${ error } ` ) ;
0 commit comments