Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add chat routes unit tests #81

Merged
merged 3 commits into from
Dec 21, 2023

Conversation

wanglam
Copy link
Collaborator

@wanglam wanglam commented Dec 20, 2023

Description

Add unit tests for chat routes, except sendMessage and regenerate.
The unit tests for regenerate has been provided in another PR (#78 ).

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a4e32b1) 83.72% compared to head (2ea1baa) 91.61%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
+ Coverage   83.72%   91.61%   +7.89%     
==========================================
  Files          43       43              
  Lines        1026     1026              
  Branches      239      239              
==========================================
+ Hits          859      940      +81     
+ Misses        166       85      -81     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 58 to 69
const triggerGetSession = (sessionId: string) =>
triggerHandler(router, {
method: 'get',
path: `${ASSISTANT_API.SESSION}/{sessionId}`,
req: httpServerMock.createRawRequest({ params: { sessionId } }),
});
const triggerGetSessions = (query: GetSessionsSchema) =>
triggerHandler(router, {
method: 'get',
path: ASSISTANT_API.SESSIONS,
req: httpServerMock.createRawRequest({ query }),
});
Copy link
Member

@SuZhou-Joe SuZhou-Joe Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there are get_session.test.ts and get_sessions.test.ts files which have already done similar test. Maybe remove the standalone files to keep just one test case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Signed-off-by: Lin Wang <wonglam@amazon.com>
@wanglam wanglam merged commit 1d63cb8 into opensearch-project:main Dec 21, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants