/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
- import * as chai from 'chai'
import 'mocha'
- import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'
+ import * as chai from 'chai'
-import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils'
+import {
- createVideoPlaylist,
- getPluginTestPath,
- getVideo,
- getVideoCategories,
- getVideoLanguages,
- getVideoLicences,
- getVideoPlaylistPrivacies,
- getVideoPrivacies,
- installPlugin,
++ cleanupTests,
++ createSingleServer,
+ makeGetRequest,
- setAccessTokensToServers,
- uninstallPlugin,
- uploadVideo
- } from '../../../shared/extra-utils'
- import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos'
- import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
++ PeerTubeServer,
++ PluginsCommand,
++ setAccessTokensToServers
++} from '@shared/extra-utils'
+ import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect
}
})
- await installPlugin({
- url: server.url,
- accessToken: server.accessToken,
- path: getPluginTestPath('-video-constants')
- })
+ it('Should be able to reset categories', async function () {
- let { body: categories } = await getVideoCategories(server.url)
++ await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') })
+
- expect(categories[1]).to.not.exist
- expect(categories[2]).to.not.exist
++ {
++ const categories = await server.videos.getCategories()
+
- expect(categories[42]).to.exist
- expect(categories[43]).to.exist
++ expect(categories[1]).to.not.exist
++ expect(categories[2]).to.not.exist
+
- statusCodeExpected: HttpStatusCode.NO_CONTENT_204
++ 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',
- const { body } = await getVideoCategories(server.url)
- categories = body
++ expectedStatus: HttpStatusCode.NO_CONTENT_204
+ })
+
- expect(categories[1]).to.exist
- expect(categories[2]).to.exist
++ {
++ const categories = await server.videos.getCategories()
+
- expect(categories[42]).to.not.exist
- expect(categories[43]).to.not.exist
++ 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 ])
})