"Improve personality registry validation and API
CI / check (22) (push) Failing after 4m50s
CI / check (24) (push) Successful in 9m43s

This commit is contained in:
2026-10-13 22:14:51 +02:00
parent 5765922765
commit 42e71fb502
4 changed files with 91 additions and 22 deletions
+2
View File
@@ -158,7 +158,9 @@ test("personality API keeps prompts private, validates IDs, and enforces chat ow
const defaultChat = await request(server.baseUrl, "/chats", {method:"POST", jar:owner, body:{systemPrompt:"Injected"}});
assert.equal(defaultChat.json.chat.personality_id, "general-assistant");
assert.equal((await request(server.baseUrl, "/chats", {method:"POST", jar:owner, body:{personalityId:"invented"}})).status, 400);
assert.equal((await request(server.baseUrl, "/chats", {method:"POST", jar:owner, body:{personalityId:["programmer"]}})).status, 400);
assert.equal((await request(server.baseUrl, `/chats/${created.json.chat.id}/personality`, {method:"PUT", jar:other, body:{personalityId:"tutor"}})).status, 404);
assert.equal((await request(server.baseUrl, `/chats/${created.json.chat.id}/personality`, {method:"PUT", jar:owner, body:{personalityId:["tutor"]}})).status, 400);
assert.equal((await request(server.baseUrl, `/chats/${created.json.chat.id}/personality`, {method:"PUT", jar:owner, body:{personalityId:"tutor"}})).json.chat.personality_id, "tutor");
assert.equal((await request(server.baseUrl, "/personas", {method:"POST", jar:owner, body:{name:"Custom"}})).status, 404);
});