aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/video-constants.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins/video-constants.ts')
-rw-r--r--server/tests/plugins/video-constants.ts40
1 files changed, 39 insertions, 1 deletions
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index f527a2b30..19cba6c2c 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -2,7 +2,14 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils' 5import {
6 cleanupTests,
7 createSingleServer,
8 makeGetRequest,
9 PeerTubeServer,
10 PluginsCommand,
11 setAccessTokensToServers
12} from '@shared/extra-utils'
6import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' 13import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
7 14
8const expect = chai.expect 15const expect = chai.expect
@@ -139,6 +146,37 @@ describe('Test plugin altering video constants', function () {
139 } 146 }
140 }) 147 })
141 148
149 it('Should be able to reset categories', async function () {
150 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') })
151
152 {
153 const categories = await server.videos.getCategories()
154
155 expect(categories[1]).to.not.exist
156 expect(categories[2]).to.not.exist
157
158 expect(categories[42]).to.exist
159 expect(categories[43]).to.exist
160 }
161
162 await makeGetRequest({
163 url: server.url,
164 token: server.accessToken,
165 path: '/plugins/test-video-constants/router/reset-categories',
166 expectedStatus: HttpStatusCode.NO_CONTENT_204
167 })
168
169 {
170 const categories = await server.videos.getCategories()
171
172 expect(categories[1]).to.exist
173 expect(categories[2]).to.exist
174
175 expect(categories[42]).to.not.exist
176 expect(categories[43]).to.not.exist
177 }
178 })
179
142 after(async function () { 180 after(async function () {
143 await cleanupTests([ server ]) 181 await cleanupTests([ server ])
144 }) 182 })