auto(agent): enhance contacts tests with validation checks

This commit is contained in:
OpenClaw 2026-03-06 19:55:19 +00:00
parent 6c82af0d99
commit 10e3527f67
2 changed files with 32 additions and 2 deletions

View file

@ -52,4 +52,34 @@ test('GET /contacts should return 401 for unauthorized access', async () => {
});
assert.strictEqual(response.statusCode, 401);
});
// Test for contacts request endpoint
test('POST /contacts/request should validate dealId and targetUserId', async () => {
const response = await app.inject({
method: 'POST',
url: '/contacts/request',
payload: { dealId: -1, targetUserId: 2 }
});
assert.strictEqual(response.statusCode, 400);
});
test('POST /contacts/respond should validate requestId and accept', async () => {
const response = await app.inject({
method: 'POST',
url: '/contacts/respond',
payload: { requestId: -1, accept: 'not-a-boolean' }
});
assert.strictEqual(response.statusCode, 400);
});
test('GET /contacts/deal/:dealId should validate dealId', async () => {
const response = await app.inject({
method: 'GET',
url: '/contacts/deal/invalid'
});
assert.strictEqual(response.statusCode, 400);
});

View file

@ -1,2 +1,2 @@
LAST_ROUTE=auth.js
UPDATED_AT=2026-03-06T19:53:13Z
LAST_ROUTE=contacts.js
UPDATED_AT=2026-03-06T19:54:59Z