import 'mocha'
import * as chai from 'chai'
+import { HttpStatusCode } from '@shared/core-utils'
import {
cleanupTests,
closeAllSequelize,
getMyUserInformation,
getPlugin,
getPluginPackageJSON,
+ getPluginTestPath,
getPublicSettings,
installPlugin,
killallServers,
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 ])