From 353f8bc0c7a71ad490e4501b8c80e13e5cec1932 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Nov 2020 11:41:38 +0100 Subject: Add registered setting CLI plugin install test --- shared/extra-utils/server/plugins.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'shared') diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts index 8f370f655..83db2f6b8 100644 --- a/shared/extra-utils/server/plugins.ts +++ b/shared/extra-utils/server/plugins.ts @@ -1,5 +1,9 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ + +import { expect } from 'chai' import { readJSON, writeJSON } from 'fs-extra' import { join } from 'path' +import { RegisteredServerSettings } from '@shared/models' import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' import { PluginType } from '../../models/plugins/plugin.type' import { buildServerDirectory, root } from '../miscs/miscs' @@ -119,6 +123,21 @@ function getPluginRegisteredSettings (parameters: { }) } +async function testHelloWorldRegisteredSettings (server: ServerInfo) { + const res = await getPluginRegisteredSettings({ + url: server.url, + accessToken: server.accessToken, + npmName: 'peertube-plugin-hello-world' + }) + + const registeredSettings = (res.body as RegisteredServerSettings).registeredSettings + + expect(registeredSettings).to.have.length.at.least(1) + + const adminNameSettings = registeredSettings.find(s => s.name === 'admin-name') + expect(adminNameSettings).to.not.be.undefined +} + function getPublicSettings (parameters: { url: string npmName: string @@ -265,6 +284,7 @@ export { updatePlugin, getPlugin, uninstallPlugin, + testHelloWorldRegisteredSettings, updatePluginSettings, getPluginRegisteredSettings, getPackageJSONPath, -- cgit v1.2.3