1 import * as request from 'supertest'
3 import { wait } from './miscs'
5 function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string) {
6 const path = '/api/v1/servers/followers'
13 .set('Accept', 'application/json')
15 .expect('Content-Type', /json/)
18 function getFollowingListPaginationAndSort (url: string, start: number, count: number, sort: string) {
19 const path = '/api/v1/servers/following'
26 .set('Accept', 'application/json')
28 .expect('Content-Type', /json/)
31 async function follow (follower: string, following: string[], accessToken: string, expectedStatus = 204) {
32 const path = '/api/v1/servers/follow'
34 const res = await request(follower)
36 .set('Accept', 'application/json')
37 .set('Authorization', 'Bearer ' + accessToken)
38 .send({ 'hosts': following })
39 .expect(expectedStatus)
41 // Wait request propagation
47 // ---------------------------------------------------------------------------
50 getFollowersListPaginationAndSort,
51 getFollowingListPaginationAndSort,