Skip to content

Test:Unit tests for POST /chat#314

Draft
Oyintarede wants to merge 3 commits into
codebestia:mainfrom
Oyintarede:Test/Unit_tests_for_POST_/chat
Draft

Test:Unit tests for POST /chat#314
Oyintarede wants to merge 3 commits into
codebestia:mainfrom
Oyintarede:Test/Unit_tests_for_POST_/chat

Conversation

@Oyintarede

@Oyintarede Oyintarede commented Jun 30, 2026

Copy link
Copy Markdown

Description

Title:
"test(ai-agent): add unit coverage for POST /chat"

Body:

closes #144

This PR adds unit coverage for the POST /chat endpoint and fixes the underlying testability issue that prevented the chat tests from running reliably.

What changed
Added unit tests covering:
missing API key returning a 500 response
successful requests returning a reply
the system prompt containing the expected Clicked and Stellar context
missing message returning 422
missing conversation_id returning 422
the correct model being used for the OpenAI request
Adjusted the OpenAI client initialization path so the existing test fixture can patch it cleanly and the endpoint can be exercised through deterministic unit tests.
This keeps the runtime behavior intact while making the endpoint easier to validate in isolation.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Other

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally
  • My code follows the project's coding standards

@codebestia codebestia marked this pull request as draft July 2, 2026 09:02
@drips-wave

drips-wave Bot commented Jul 2, 2026

Copy link
Copy Markdown

@Oyintarede Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit tests for POST /chat

1 participant