]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/plugins.ts
Fix tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / plugins.ts
index fbcf4651eefc2cf60fb9bae1f1d6662f67b453c6..a0e9db1d3c840ea7dac7c824362936bdfb22cb76 100644 (file)
@@ -1,9 +1,9 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import * as chai from 'chai'
+import { expect } from 'chai'
 import { pathExists, remove } from 'fs-extra'
 import { join } from 'path'
-import { testHelloWorldRegisteredSettings } from '@server/tests/shared'
+import { SQLCommand, testHelloWorldRegisteredSettings } from '@server/tests/shared'
 import { wait } from '@shared/core-utils'
 import { HttpStatusCode, PluginType } from '@shared/models'
 import {
@@ -16,10 +16,9 @@ import {
   setAccessTokensToServers
 } from '@shared/server-commands'
 
-const expect = chai.expect
-
 describe('Test plugins', function () {
-  let server: PeerTubeServer = null
+  let server: PeerTubeServer
+  let sqlCommand: SQLCommand
   let command: PluginsCommand
 
   before(async function () {
@@ -34,6 +33,8 @@ describe('Test plugins', function () {
     await setAccessTokensToServers([ server ])
 
     command = server.plugins
+
+    sqlCommand = new SQLCommand(server)
   })
 
   it('Should list and search available plugins and themes', async function () {
@@ -188,8 +189,6 @@ describe('Test plugins', function () {
   })
 
   it('Should have watched settings changes', async function () {
-    this.timeout(10000)
-
     await server.servers.waitUntilLog('Settings changed!')
   })
 
@@ -238,7 +237,7 @@ describe('Test plugins', function () {
 
     async function testUpdate (type: 'plugin' | 'theme', name: string) {
       // Fake update our plugin version
-      await server.sql.setPluginVersion(name, '0.0.1')
+      await sqlCommand.setPluginVersion(name, '0.0.1')
 
       // Fake update package.json
       const packageJSON = await command.getPackageJSON(`peertube-${type}-${name}`)
@@ -368,7 +367,7 @@ describe('Test plugins', function () {
     })
 
     const query = `UPDATE "application" SET "nodeABIVersion" = 1`
-    await server.sql.updateQuery(query)
+    await sqlCommand.updateQuery(query)
 
     const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example'))
 
@@ -403,6 +402,8 @@ describe('Test plugins', function () {
   })
 
   after(async function () {
+    await sqlCommand.cleanup()
+
     await cleanupTests([ server ])
   })
 })