1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
5 import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'
10 setAccessTokensToServers,
12 } from '../../../shared/extra-utils'
14 const expect = chai.expect
16 describe('Test plugin translations', function () {
17 let server: ServerInfo
19 before(async function () {
22 server = await flushAndRunServer(1)
23 await setAccessTokensToServers([ server ])
27 accessToken: server.accessToken,
28 path: getPluginTestPath()
33 accessToken: server.accessToken,
34 path: getPluginTestPath('-two')
38 it('Should not have translations for locale pt', async function () {
39 const res = await getPluginTranslations({ url: server.url, locale: 'pt' })
41 expect(res.body).to.deep.equal({})
44 it('Should have translations for locale fr', async function () {
45 const res = await getPluginTranslations({ url: server.url, locale: 'fr-FR' })
47 expect(res.body).to.deep.equal({
48 'peertube-plugin-test': {
51 'peertube-plugin-test-two': {
52 'Hello world': 'Bonjour le monde'
57 it('Should have translations of locale it', async function () {
58 const res = await getPluginTranslations({ url: server.url, locale: 'it-IT' })
60 expect(res.body).to.deep.equal({
61 'peertube-plugin-test-two': {
62 'Hello world': 'Ciao, mondo!'
67 it('Should remove the plugin and remove the locales', async function () {
68 await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-test-two' })
71 const res = await getPluginTranslations({ url: server.url, locale: 'fr-FR' })
73 expect(res.body).to.deep.equal({
74 'peertube-plugin-test': {
81 const res = await getPluginTranslations({ url: server.url, locale: 'it-IT' })
83 expect(res.body).to.deep.equal({})
87 after(async function () {
88 await cleanupTests([ server ])