1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import { expect } from 'chai'
4 import { pathExists, readdir } from 'fs-extra'
5 import { join } from 'path'
6 import { root } from '@server/helpers/core-utils'
7 import { ServerInfo } from '../server'
9 async function expectAccountFollows (options: {
15 const { server, handle, followers, following } = options
17 const body = await server.accountsCommand.list()
18 const account = body.data.find(a => a.name + '@' + a.host === handle)
20 const message = `${handle} on ${server.url}`
21 expect(account.followersCount).to.equal(followers, message)
22 expect(account.followingCount).to.equal(following, message)
25 async function checkActorFilesWereRemoved (filename: string, serverNumber: number) {
26 const testDirectory = 'test' + serverNumber
28 for (const directory of [ 'avatars' ]) {
29 const directoryPath = join(root(), testDirectory, directory)
31 const directoryExists = await pathExists(directoryPath)
32 expect(directoryExists).to.be.true
34 const files = await readdir(directoryPath)
35 for (const file of files) {
36 expect(file).to.not.contain(filename)
43 checkActorFilesWereRemoved