aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/users
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/users')
-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}