diff options
Diffstat (limited to 'server/tests/utils/users/accounts.ts')
-rw-r--r-- | server/tests/utils/users/accounts.ts | 25 |
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 | |||
1 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { existsSync } from 'fs' | ||
5 | import { join } from 'path' | ||
2 | import { Account } from '../../../../shared/models/actors' | 6 | import { Account } from '../../../../shared/models/actors' |
7 | import { readdirPromise } from '../../../helpers/core-utils' | ||
8 | import { root } from '../index' | ||
3 | import { makeGetRequest } from '../requests/requests' | 9 | import { makeGetRequest } from '../requests/requests' |
4 | 10 | ||
5 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { | 11 | function 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 | ||
41 | async 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 | ||
37 | export { | 59 | export { |
38 | getAccount, | 60 | getAccount, |
39 | expectAccountFollows, | 61 | expectAccountFollows, |
40 | getAccountsList | 62 | getAccountsList, |
63 | checkActorFilesWereRemoved | ||
41 | } | 64 | } |