X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fvideo-constants.ts;h=c388f02d1de4befb7231194750e63bbe14dd7e81;hb=HEAD;hp=953916e8ec8c6ca451a61876ffdc3f49b6893f34;hpb=254d3579f5338f5fd775c17d15cdfc37078bcfb4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts index 953916e8e..c388f02d1 100644 --- a/server/tests/plugins/video-constants.ts +++ b/server/tests/plugins/video-constants.ts @@ -1,12 +1,15 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' -import { HttpStatusCode } from '@shared/core-utils' -import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { VideoPlaylistPrivacy } from '@shared/models' - -const expect = chai.expect +import { expect } from 'chai' +import { + cleanupTests, + createSingleServer, + makeGetRequest, + PeerTubeServer, + PluginsCommand, + setAccessTokensToServers +} from '@shared/server-commands' +import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' describe('Test plugin altering video constants', function () { let server: PeerTubeServer @@ -140,6 +143,37 @@ describe('Test plugin altering video constants', function () { } }) + 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 ]) })