1 import { expect } from 'chai'
2 import { Account } from '../../../../shared/models/actors'
3 import { makeGetRequest } from '../requests/requests'
5 function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) {
6 const path = '/api/v1/accounts'
8 return makeGetRequest({
16 function getAccount (url: string, accountId: number | string, statusCodeExpected = 200) {
17 const path = '/api/v1/accounts/' + accountId
19 return makeGetRequest({
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)
30 const message = `${nameWithDomain} on ${url}`
31 expect(account.followersCount).to.equal(followersCount, message)
32 expect(account.followingCount).to.equal(followingCount, message)
35 // ---------------------------------------------------------------------------