]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/plugins.ts
Merge branch 'master' into release/3.3.0
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / plugins.ts
index 3c09acc9a5ece9607f378673ad8a8374903a1373..6b61c7c33705384733584872d4fe6d7d7daa62f0 100644 (file)
@@ -2,6 +2,7 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { HttpStatusCode } from '@shared/core-utils'
 import {
   cleanupTests,
   closeAllSequelize,
@@ -10,6 +11,7 @@ import {
   getMyUserInformation,
   getPlugin,
   getPluginPackageJSON,
+  getPluginTestPath,
   getPublicSettings,
   installPlugin,
   killallServers,
@@ -284,7 +286,7 @@ describe('Test plugins', function () {
   })
 
   it('Should update the plugin and the theme', async function () {
-    this.timeout(30000)
+    this.timeout(90000)
 
     // Wait the scheduler that get the latest plugins versions
     await wait(6000)
@@ -400,6 +402,36 @@ describe('Test plugins', function () {
     expect((res.body as User).theme).to.equal('instance-default')
   })
 
+  it('Should not install a broken plugin', async function () {
+    this.timeout(60000)
+
+    async function check () {
+      const res = await listPlugins({
+        url: server.url,
+        accessToken: server.accessToken,
+        pluginType: PluginType.PLUGIN
+      })
+
+      const plugins: PeerTubePlugin[] = res.body.data
+
+      expect(plugins.find(p => p.name === 'test-broken')).to.not.exist
+    }
+
+    await installPlugin({
+      url: server.url,
+      accessToken: server.accessToken,
+      path: getPluginTestPath('-broken'),
+      expectedStatus: HttpStatusCode.BAD_REQUEST_400
+    })
+
+    await check()
+
+    killallServers([ server ])
+    await reRunServer(server)
+
+    await check()
+  })
+
   after(async function () {
     await closeAllSequelize([ server ])
     await cleanupTests([ server ])