aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/server/follows.ts37
1 files changed, 37 insertions, 0 deletions
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index e6dfd5f62..27cf94985 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -12,6 +12,7 @@ import {
12} from '../../utils/index' 12} from '../../utils/index'
13import { dateIsValid } from '../../utils/miscs/miscs' 13import { dateIsValid } from '../../utils/miscs/miscs'
14import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows' 14import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows'
15import { expectAccountFollows } from '../../utils/users/accounts'
15import { userLogin } from '../../utils/users/login' 16import { userLogin } from '../../utils/users/login'
16import { createUser } from '../../utils/users/users' 17import { createUser } from '../../utils/users/users'
17import { 18import {
@@ -116,6 +117,19 @@ describe('Test follows', function () {
116 expect(follows.length).to.equal(0) 117 expect(follows.length).to.equal(0)
117 }) 118 })
118 119
120 it('Should have the correct following counts', async function () {
121 await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2)
122 await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0)
123 await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0)
124
125 // Server 2 and 3 does not know server 1 follow another server (there was not a refresh)
126 await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1)
127 await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0)
128
129 await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 1)
130 await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 1, 0)
131 })
132
119 it('Should unfollow server 3 on server 1', async function () { 133 it('Should unfollow server 3 on server 1', async function () {
120 this.timeout(5000) 134 this.timeout(5000)
121 135
@@ -144,6 +158,17 @@ describe('Test follows', function () {
144 expect(follows.length).to.equal(0) 158 expect(follows.length).to.equal(0)
145 }) 159 })
146 160
161 it('Should have the correct following counts 2', async function () {
162 await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 1)
163 await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0)
164
165 await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1)
166 await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0)
167
168 await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 0)
169 await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 0, 0)
170 })
171
147 it('Should upload a video on server 2 ans 3 and propagate only the video of server 2', async function () { 172 it('Should upload a video on server 2 ans 3 and propagate only the video of server 2', async function () {
148 this.timeout(10000) 173 this.timeout(10000)
149 174
@@ -223,6 +248,18 @@ describe('Test follows', function () {
223 await wait(7000) 248 await wait(7000)
224 }) 249 })
225 250
251 it('Should have the correct following counts 2', async function () {
252 await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2)
253 await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0)
254 await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0)
255
256 await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1)
257 await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0)
258
259 await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 1)
260 await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 1, 0)
261 })
262
226 it('Should propagate videos', async function () { 263 it('Should propagate videos', async function () {
227 const res = await getVideosList(servers[ 0 ].url) 264 const res = await getVideosList(servers[ 0 ].url)
228 expect(res.body.total).to.equal(7) 265 expect(res.body.total).to.equal(7)