}
async function follow (follower: string, following: string[], accessToken: string, expectedStatus = 204) {
- const path = '/api/v1/server/follow'
+ const path = '/api/v1/server/following'
const followingHosts = following.map(f => f.replace(/^http:\/\//, ''))
const res = await request(follower)
.send({ 'hosts': followingHosts })
.expect(expectedStatus)
- // Wait request propagation
- await wait(20000)
+ return res
+}
+
+async function unfollow (url: string, accessToken: string, id: number, expectedStatus = 204) {
+ const path = '/api/v1/server/following/' + id
+
+ const res = await request(url)
+ .delete(path)
+ .set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + accessToken)
+ .expect(expectedStatus)
return res
}
follow(server2.url, [ server1.url ], server2.accessToken)
])
+ // Wait request propagation
+ await wait(20000)
+
return true
}
export {
getFollowersListPaginationAndSort,
getFollowingListPaginationAndSort,
+ unfollow,
follow,
doubleFollow
}