X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fplugin-storage.ts;h=112652a1fe23d3d4825a2ffbd76ad371f0ca1252;hb=910744fb084499a110d26bf5542abebb8a750b19;hp=9babfc83e0d1a141329a3c89102a6e84d6a92786;hpb=6c5065a011b099618681a37bd77eaa7bd3db752e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/plugin-storage.ts b/server/tests/plugins/plugin-storage.ts index 9babfc83e..112652a1f 100644 --- a/server/tests/plugins/plugin-storage.ts +++ b/server/tests/plugins/plugin-storage.ts @@ -1,28 +1,38 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { expect } from 'chai' import { pathExists, readdir, readFile } from 'fs-extra' import { join } from 'path' -import { HttpStatusCode } from '@shared/core-utils' -import { cleanupTests, flushAndRunServer, makeGetRequest, PluginsCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' +import { + cleanupTests, + createSingleServer, + makeGetRequest, + PeerTubeServer, + PluginsCommand, + setAccessTokensToServers +} from '@shared/server-commands' +import { HttpStatusCode } from '@shared/models' describe('Test plugin storage', function () { - let server: ServerInfo + let server: PeerTubeServer before(async function () { this.timeout(30000) - server = await flushAndRunServer(1) + server = await createSingleServer(1) await setAccessTokensToServers([ server ]) - await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-six') }) + await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-six') }) }) describe('DB storage', function () { - it('Should correctly store a subkey', async function () { - await server.serversCommand.waitUntilLog('superkey stored value is toto') + await server.servers.waitUntilLog('superkey stored value is toto') + }) + + it('Should correctly retrieve an array as array from the storage.', async function () { + await server.servers.waitUntilLog('storedArrayKey isArray is true') + await server.servers.waitUntilLog('storedArrayKey stored value is toto, toto2') }) }) @@ -38,12 +48,12 @@ describe('Test plugin storage', function () { } before(function () { - dataPath = server.serversCommand.buildDirectory('plugins/data') + dataPath = server.servers.buildDirectory('plugins/data') pluginDataPath = join(dataPath, 'peertube-plugin-test-six') }) it('Should have created the directory on install', async function () { - const dataPath = server.serversCommand.buildDirectory('plugins/data') + const dataPath = server.servers.buildDirectory('plugins/data') const pluginDataPath = join(dataPath, 'peertube-plugin-test-six') expect(await pathExists(dataPath)).to.be.true @@ -56,7 +66,7 @@ describe('Test plugin storage', function () { url: server.url, token: server.accessToken, path: '/plugins/test-six/router/create-file', - statusCodeExpected: HttpStatusCode.OK_200 + expectedStatus: HttpStatusCode.OK_200 }) const content = await getFileContent() @@ -64,14 +74,14 @@ describe('Test plugin storage', function () { }) it('Should still have the file after an uninstallation', async function () { - await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-six' }) + await server.plugins.uninstall({ npmName: 'peertube-plugin-test-six' }) const content = await getFileContent() expect(content).to.equal('Prince Ali') }) it('Should still have the file after the reinstallation', async function () { - await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-six') }) + await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-six') }) const content = await getFileContent() expect(content).to.equal('Prince Ali')