diff options
Diffstat (limited to 'server/tests/plugins/plugin-helpers.ts')
-rw-r--r-- | server/tests/plugins/plugin-helpers.ts | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index 05928273f..dfe8ebe55 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts | |||
@@ -1,11 +1,16 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
5 | import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' | 4 | import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' |
6 | import { getPluginTestPath, installPlugin, setAccessTokensToServers } from '../../../shared/extra-utils' | 5 | import { |
7 | 6 | checkVideoFilesWereRemoved, | |
8 | const expect = chai.expect | 7 | getPluginTestPath, |
8 | getVideo, | ||
9 | installPlugin, | ||
10 | setAccessTokensToServers, | ||
11 | uploadVideoAndGetId, | ||
12 | viewVideo | ||
13 | } from '../../../shared/extra-utils' | ||
9 | 14 | ||
10 | describe('Test plugin helpers', function () { | 15 | describe('Test plugin helpers', function () { |
11 | let server: ServerInfo | 16 | let server: ServerInfo |
@@ -32,6 +37,29 @@ describe('Test plugin helpers', function () { | |||
32 | await waitUntilLog(server, `root email is admin${server.internalServerNumber}@example.com`, 1) | 37 | await waitUntilLog(server, `root email is admin${server.internalServerNumber}@example.com`, 1) |
33 | }) | 38 | }) |
34 | 39 | ||
40 | it('Should remove a video after a view', async function () { | ||
41 | this.timeout(20000) | ||
42 | |||
43 | const videoUUID = (await uploadVideoAndGetId({ server: server, videoName: 'video1' })).uuid | ||
44 | |||
45 | // Should not throw -> video exists | ||
46 | await getVideo(server.url, videoUUID) | ||
47 | // Should delete the video | ||
48 | await viewVideo(server.url, videoUUID) | ||
49 | |||
50 | await waitUntilLog(server, 'Video deleted by plugin four.', 1) | ||
51 | |||
52 | try { | ||
53 | // Should throw because the video should have been deleted | ||
54 | await getVideo(server.url, videoUUID) | ||
55 | throw new Error('Video exists') | ||
56 | } catch (err) { | ||
57 | if (err.message.includes('exists')) throw err | ||
58 | } | ||
59 | |||
60 | await checkVideoFilesWereRemoved(videoUUID, server.internalServerNumber) | ||
61 | }) | ||
62 | |||
35 | after(async function () { | 63 | after(async function () { |
36 | await cleanupTests([ server ]) | 64 | await cleanupTests([ server ]) |
37 | }) | 65 | }) |