+ const user = await server.users.getMyInfo()
+ expect(user.theme).to.equal('instance-default')
+ })
+
+ it('Should not install a broken plugin', async function () {
+ this.timeout(60000)
+
+ async function check () {
+ const body = await command.list({ pluginType: PluginType.PLUGIN })
+ const plugins = body.data
+ expect(plugins.find(p => p.name === 'test-broken')).to.not.exist
+ }
+
+ await command.install({
+ path: PluginsCommand.getPluginTestPath('-broken'),
+ expectedStatus: HttpStatusCode.BAD_REQUEST_400
+ })
+
+ await check()
+
+ await killallServers([ server ])
+ await server.run()
+
+ await check()
+ })
+
+ it('Should rebuild native modules on Node ABI change', async function () {
+ this.timeout(60000)
+
+ const removeNativeModule = async () => {
+ await remove(join(baseNativeModule, 'build'))
+ await remove(join(baseNativeModule, 'prebuilds'))
+ }
+
+ await command.install({ path: PluginsCommand.getPluginTestPath('-native') })
+
+ await makeGetRequest({
+ url: server.url,
+ path: '/plugins/test-native/router',
+ expectedStatus: HttpStatusCode.NO_CONTENT_204
+ })
+
+ const query = `UPDATE "application" SET "nodeABIVersion" = 1`
+ await server.sql.updateQuery(query)
+
+ const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example'))
+
+ await removeNativeModule()
+ await server.kill()
+ await server.run()
+
+ await wait(3000)
+
+ expect(await pathExists(join(baseNativeModule, 'build'))).to.be.true
+ expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.true
+
+ await makeGetRequest({
+ url: server.url,
+ path: '/plugins/test-native/router',
+ expectedStatus: HttpStatusCode.NO_CONTENT_204
+ })
+
+ await removeNativeModule()
+
+ await server.kill()
+ await server.run()
+
+ expect(await pathExists(join(baseNativeModule, 'build'))).to.be.false
+ expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.false
+
+ await makeGetRequest({
+ url: server.url,
+ path: '/plugins/test-native/router',
+ expectedStatus: HttpStatusCode.NOT_FOUND_404
+ })