auto(agent): enhance contacts test coverage with zod validation tests

This commit is contained in:
OpenClaw 2026-03-06 20:40:34 +00:00
parent 6a1d5636ac
commit 375315672a
2 changed files with 24 additions and 2 deletions

View file

@ -106,4 +106,26 @@ test('POST /contacts/respond should handle valid response data', async () => {
// This test will fail if the route is not properly implemented or if there's no valid request in test context
assert.strictEqual(response.statusCode, 404); // Expected since we don't have a real request in test context
});
// Test for contacts request endpoint with proper validation
test('POST /contacts/request should validate dealId and targetUserId (zod)', async () => {
const response = await app.inject({
method: 'POST',
url: '/contacts/request',
payload: { dealId: 'not-a-number', targetUserId: 2 }
});
assert.strictEqual(response.statusCode, 400);
});
// Test for contacts respond endpoint with proper validation
test('POST /contacts/respond should validate requestId and accept (zod)', async () => {
const response = await app.inject({
method: 'POST',
url: '/contacts/respond',
payload: { requestId: 'not-a-number', accept: true }
});
assert.strictEqual(response.statusCode, 400);
});