aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/users/accounts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/users/accounts.ts')
-rw-r--r--server/tests/utils/users/accounts.ts25
1 files changed, 24 insertions, 1 deletions
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts
index 0ec7992b3..a5c13c319 100644
--- a/server/tests/utils/users/accounts.ts
+++ b/server/tests/utils/users/accounts.ts
@@ -1,5 +1,11 @@
1/* tslint:disable:no-unused-expression */
2
1import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync } from 'fs'
5import { join } from 'path'
2import { Account } from '../../../../shared/models/actors' 6import { Account } from '../../../../shared/models/actors'
7import { readdirPromise } from '../../../helpers/core-utils'
8import { root } from '../index'
3import { makeGetRequest } from '../requests/requests' 9import { makeGetRequest } from '../requests/requests'
4 10
5function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { 11function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) {
@@ -32,10 +38,27 @@ async function expectAccountFollows (url: string, nameWithDomain: string, follow
32 expect(account.followingCount).to.equal(followingCount, message) 38 expect(account.followingCount).to.equal(followingCount, message)
33} 39}
34 40
41async function checkActorFilesWereRemoved (actorUUID: string, serverNumber: number) {
42 const testDirectory = 'test' + serverNumber
43
44 for (const directory of [ 'avatars' ]) {
45 const directoryPath = join(root(), testDirectory, directory)
46
47 const directoryExists = existsSync(directoryPath)
48 expect(directoryExists).to.be.true
49
50 const files = await readdirPromise(directoryPath)
51 for (const file of files) {
52 expect(file).to.not.contain(actorUUID)
53 }
54 }
55}
56
35// --------------------------------------------------------------------------- 57// ---------------------------------------------------------------------------
36 58
37export { 59export {
38 getAccount, 60 getAccount,
39 expectAccountFollows, 61 expectAccountFollows,
40 getAccountsList 62 getAccountsList,
63 checkActorFilesWereRemoved
41} 64}