]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/plugins/plugin-storage.ts
Fix server run
[github/Chocobozzz/PeerTube.git] / server / tests / plugins / plugin-storage.ts
index 4c65463f26cf759c5b52d0de880dba880697ce99..5745914a53b280e920f2ff402513be75ca630838 100644 (file)
@@ -6,32 +6,30 @@ import { pathExists, readdir, readFile } from 'fs-extra'
 import { join } from 'path'
 import { HttpStatusCode } from '@shared/core-utils'
 import {
-  buildServerDirectory,
   cleanupTests,
-  flushAndRunServer,
+  createSingleServer,
   makeGetRequest,
+  PeerTubeServer,
   PluginsCommand,
-  ServerInfo,
-  setAccessTokensToServers,
-  waitUntilLog
+  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 waitUntilLog(server, 'superkey stored value is toto')
+      await server.servers.waitUntilLog('superkey stored value is toto')
     })
   })
 
@@ -47,12 +45,12 @@ describe('Test plugin storage', function () {
     }
 
     before(function () {
-      dataPath = buildServerDirectory(server, '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 = buildServerDirectory(server, 'plugins/data')
+      const dataPath = server.servers.buildDirectory('plugins/data')
       const pluginDataPath = join(dataPath, 'peertube-plugin-test-six')
 
       expect(await pathExists(dataPath)).to.be.true
@@ -73,14 +71,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')