import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils'
+import {
+ cleanupTests,
+ createSingleServer,
+ makeGetRequest,
+ PeerTubeServer,
+ PluginsCommand,
+ setAccessTokensToServers
+} from '@shared/extra-utils'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect
}
})
+ it('Should be able to reset categories', async function () {
+ await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') })
+
+ {
+ const categories = await server.videos.getCategories()
+
+ expect(categories[1]).to.not.exist
+ expect(categories[2]).to.not.exist
+
+ expect(categories[42]).to.exist
+ expect(categories[43]).to.exist
+ }
+
+ await makeGetRequest({
+ url: server.url,
+ token: server.accessToken,
+ path: '/plugins/test-video-constants/router/reset-categories',
+ expectedStatus: HttpStatusCode.NO_CONTENT_204
+ })
+
+ {
+ const categories = await server.videos.getCategories()
+
+ expect(categories[1]).to.exist
+ expect(categories[2]).to.exist
+
+ expect(categories[42]).to.not.exist
+ expect(categories[43]).to.not.exist
+ }
+ })
+
after(async function () {
await cleanupTests([ server ])
})