fix(test): update plugin-base-config spec to match findMany implementation

getEffectiveConfig was rewritten in 948a20b88 to fetch all configs via
findMany (Prisma cannot reliably WHERE on nullable String? with ''), but
the spec still mocked the old findFirst call chain — the table-override
test silently fell back to defaults. Mocks now return the config array.
This commit is contained in:
yeuimu
2026-08-14 07:27:22 +00:00
parent 07836c0165
commit 4dc65c2a0c
2 changed files with 182 additions and 2 deletions
+32
View File
@@ -218,6 +218,15 @@ class Client {
getPlugins() {
return this.call('GET', '/api/plugin');
}
getPlugin(pluginId) {
return this.call('GET', `/api/plugin/${encodeURIComponent(pluginId)}`);
}
updatePlugin(pluginId, body) {
return this.call('PUT', `/api/plugin/${encodeURIComponent(pluginId)}`, body);
}
getCspOrigins() {
return this.call('GET', '/api/plugin/csp-origins');
}
registerPlugin(body) {
return this.call('POST', '/api/plugin', body);
}
@@ -227,5 +236,28 @@ class Client {
upsertPluginConfig(baseId, pluginId, body) {
return this.call('PUT', `/api/base/${baseId}/plugin-config/${pluginId}`, body);
}
// ---- plugin installs ----
listInstalls(baseId) {
return this.call('GET', `/api/base/${baseId}/plugin-installs`);
}
createInstall(baseId, body) {
return this.call('POST', `/api/base/${baseId}/plugin-installs`, body);
}
deleteInstall(baseId, installId) {
return this.call('DELETE', `/api/base/${baseId}/plugin-installs/${installId}`);
}
// ---- plugin developers ----
listDevelopers() {
return this.call('GET', '/api/plugin-developers');
}
addDeveloper(userIdOrEmail) {
// Backend reads @Body('userId') or @Body('email'). Send whichever looks right.
const isEmail = userIdOrEmail.includes('@');
const body = isEmail ? { email: userIdOrEmail } : { userId: userIdOrEmail };
return this.call('POST', '/api/plugin-developers', body);
}
removeDeveloper(userId) {
return this.call('DELETE', `/api/plugin-developers/${encodeURIComponent(userId)}`);
}
}
exports.Client = Client;