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/extra-utils'
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')
})
})
}
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
})
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')