diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-12 11:47:45 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-12 11:47:45 +0100 |
commit | 32b2b43c06621e384c0bd1610ef0bb9f23399be7 (patch) | |
tree | c195943354838bcbe3b1993d77aaf0d3200fd19d /server/tests/utils/users/accounts.ts | |
parent | 6502c3d43e512e968ad49f5a3bc9abc302471e18 (diff) | |
download | PeerTube-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.ts | 12 |
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 @@ | |||
1 | import { expect } from 'chai' | ||
2 | import { Account } from '../../../../shared/models/actors' | ||
1 | import { makeGetRequest } from '../requests/requests' | 3 | import { makeGetRequest } from '../requests/requests' |
2 | 4 | ||
3 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { | 5 | function 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 | ||
26 | async 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 | ||
26 | export { | 37 | export { |
27 | getAccount, | 38 | getAccount, |
39 | expectAccountFollows, | ||
28 | getAccountsList | 40 | getAccountsList |
29 | } | 41 | } |