diff options
Diffstat (limited to 'server/tests/utils/users')
-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 | } |