From 32b2b43c06621e384c0bd1610ef0bb9f23399be7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Jan 2018 11:47:45 +0100 Subject: Update follower/following counts --- server/tests/utils/users/accounts.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'server/tests/utils') 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 @@ +import { expect } from 'chai' +import { Account } from '../../../../shared/models/actors' import { makeGetRequest } from '../requests/requests' function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { @@ -21,9 +23,19 @@ function getAccount (url: string, accountId: number | string, statusCodeExpected }) } +async function expectAccountFollows (url: string, nameWithDomain: string, followersCount: number, followingCount: number) { + const res = await getAccountsList(url) + const account = res.body.data.find((a: Account) => a.name + '@' + a.host === nameWithDomain) + + const message = `${nameWithDomain} on ${url}` + expect(account.followersCount).to.equal(followersCount, message) + expect(account.followingCount).to.equal(followingCount, message) +} + // --------------------------------------------------------------------------- export { getAccount, + expectAccountFollows, getAccountsList } -- cgit v1.2.3