diff options
Diffstat (limited to 'server/tests/utils/pods.js')
-rw-r--r-- | server/tests/utils/pods.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/server/tests/utils/pods.js b/server/tests/utils/pods.js index 25b97edec..cdabb64a6 100644 --- a/server/tests/utils/pods.js +++ b/server/tests/utils/pods.js | |||
@@ -5,7 +5,8 @@ const request = require('supertest') | |||
5 | const podsUtils = { | 5 | const podsUtils = { |
6 | getFriendsList, | 6 | getFriendsList, |
7 | makeFriends, | 7 | makeFriends, |
8 | quitFriends | 8 | quitFriends, |
9 | quitOneFriend | ||
9 | } | 10 | } |
10 | 11 | ||
11 | // ---------------------- Export functions -------------------- | 12 | // ---------------------- Export functions -------------------- |
@@ -90,6 +91,26 @@ function quitFriends (url, accessToken, expectedStatus, end) { | |||
90 | }) | 91 | }) |
91 | } | 92 | } |
92 | 93 | ||
94 | function quitOneFriend (url, accessToken, friendId, expectedStatus, end) { | ||
95 | if (!end) { | ||
96 | end = expectedStatus | ||
97 | expectedStatus = 204 | ||
98 | } | ||
99 | |||
100 | const path = '/api/v1/pods/' + friendId | ||
101 | |||
102 | request(url) | ||
103 | .delete(path) | ||
104 | .set('Accept', 'application/json') | ||
105 | .set('Authorization', 'Bearer ' + accessToken) | ||
106 | .expect(expectedStatus) | ||
107 | .end(function (err, res) { | ||
108 | if (err) throw err | ||
109 | |||
110 | end() | ||
111 | }) | ||
112 | } | ||
113 | |||
93 | // --------------------------------------------------------------------------- | 114 | // --------------------------------------------------------------------------- |
94 | 115 | ||
95 | module.exports = podsUtils | 116 | module.exports = podsUtils |