From 0f91ae62df8a37194fea84ce1efa9e733d9c1fd8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Nov 2017 13:43:29 +0100 Subject: Add follow tests --- server/tests/utils/follows.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'server/tests/utils/follows.ts') diff --git a/server/tests/utils/follows.ts b/server/tests/utils/follows.ts index 618436b3c..b88776011 100644 --- a/server/tests/utils/follows.ts +++ b/server/tests/utils/follows.ts @@ -42,6 +42,18 @@ async function follow (follower: string, following: string[], accessToken: strin 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 +} + async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { await Promise.all([ follow(server1.url, [ server2.url ], server1.accessToken), @@ -59,6 +71,7 @@ async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { export { getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, + unfollow, follow, doubleFollow } -- cgit v1.2.3