aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/users/accounts.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-12 11:47:45 +0100
committerChocobozzz <me@florianbigard.com>2018-01-12 11:47:45 +0100
commit32b2b43c06621e384c0bd1610ef0bb9f23399be7 (patch)
treec195943354838bcbe3b1993d77aaf0d3200fd19d /server/tests/utils/users/accounts.ts
parent6502c3d43e512e968ad49f5a3bc9abc302471e18 (diff)
downloadPeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.tar.gz
PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.tar.zst
PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.zip
Update follower/following counts
Diffstat (limited to 'server/tests/utils/users/accounts.ts')
-rw-r--r--server/tests/utils/users/accounts.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts
index 71712100e..0ec7992b3 100644
--- a/server/tests/utils/users/accounts.ts
+++ b/server/tests/utils/users/accounts.ts
@@ -1,3 +1,5 @@
1import { expect } from 'chai'
2import { Account } from '../../../../shared/models/actors'
1import { makeGetRequest } from '../requests/requests' 3import { makeGetRequest } from '../requests/requests'
2 4
3function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { 5function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) {
@@ -21,9 +23,19 @@ function getAccount (url: string, accountId: number | string, statusCodeExpected
21 }) 23 })
22} 24}
23 25
26async function expectAccountFollows (url: string, nameWithDomain: string, followersCount: number, followingCount: number) {
27 const res = await getAccountsList(url)
28 const account = res.body.data.find((a: Account) => a.name + '@' + a.host === nameWithDomain)
29
30 const message = `${nameWithDomain} on ${url}`
31 expect(account.followersCount).to.equal(followersCount, message)
32 expect(account.followingCount).to.equal(followingCount, message)
33}
34
24// --------------------------------------------------------------------------- 35// ---------------------------------------------------------------------------
25 36
26export { 37export {
27 getAccount, 38 getAccount,
39 expectAccountFollows,
28 getAccountsList 40 getAccountsList
29} 41}