]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/plugins/plugin-unloading.ts
Reorganize imports
[github/Chocobozzz/PeerTube.git] / server / tests / plugins / plugin-unloading.ts
index f430f82b82f8f79c372c1604d77a5c76f04f8f2f..6bf2fda9b3610034cf587fef9e768cbf127d14d9 100644 (file)
@@ -2,28 +2,35 @@
 
 import 'mocha'
 import { expect } from 'chai'
-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'
+import { HttpStatusCode } from '@shared/models'
 
 describe('Test plugins module unloading', function () {
-  let server: ServerInfo = null
+  let server: PeerTubeServer = null
   const requestPath = '/plugins/test-unloading/router/get'
   let value: string = null
 
   before(async function () {
     this.timeout(30000)
 
-    server = await flushAndRunServer(1)
+    server = await createSingleServer(1)
     await setAccessTokensToServers([ server ])
 
-    await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-unloading') })
+    await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-unloading') })
   })
 
   it('Should return a numeric value', async function () {
     const res = await makeGetRequest({
       url: server.url,
       path: requestPath,
-      statusCodeExpected: HttpStatusCode.OK_200
+      expectedStatus: HttpStatusCode.OK_200
     })
 
     expect(res.body.message).to.match(/^\d+$/)
@@ -34,29 +41,29 @@ describe('Test plugins module unloading', function () {
     const res = await makeGetRequest({
       url: server.url,
       path: requestPath,
-      statusCodeExpected: HttpStatusCode.OK_200
+      expectedStatus: HttpStatusCode.OK_200
     })
 
     expect(res.body.message).to.be.equal(value)
   })
 
   it('Should uninstall the plugin and free the route', async function () {
-    await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-unloading' })
+    await server.plugins.uninstall({ npmName: 'peertube-plugin-test-unloading' })
 
     await makeGetRequest({
       url: server.url,
       path: requestPath,
-      statusCodeExpected: HttpStatusCode.NOT_FOUND_404
+      expectedStatus: HttpStatusCode.NOT_FOUND_404
     })
   })
 
   it('Should return a different numeric value', async function () {
-    await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-unloading') })
+    await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-unloading') })
 
     const res = await makeGetRequest({
       url: server.url,
       path: requestPath,
-      statusCodeExpected: HttpStatusCode.OK_200
+      expectedStatus: HttpStatusCode.OK_200
     })
 
     expect(res.body.message).to.match(/^\d+$/)