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

test: add unit test for save to notebook feature #62

Merged

Conversation

raintygao
Copy link
Collaborator

Description

  1. add unit test for save to notebook feature
  2. move toast logic to caller side

Issues Resolved

List any issues this PR will resolve, e.g. Closes [...].

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.

Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c70bcfc) 48.75% compared to head (5086cd4) 65.28%.
Report is 3 commits behind head on feature/agent-framework.

Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/agent-framework      #62       +/-   ##
============================================================
+ Coverage                    48.75%   65.28%   +16.52%     
============================================================
  Files                           46       41        -5     
  Lines                         1087      965      -122     
  Branches                       250      231       -19     
============================================================
+ Hits                           530      630      +100     
+ Misses                         548      331      -217     
+ Partials                         9        4        -5     

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

public/components/notebook/notebook_name_modal.tsx Outdated Show resolved Hide resolved
),
});
} catch (error) {
if (error.message === 'Not Found') {
Copy link
Member

Choose a reason for hiding this comment

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

This may out of the scope of this PR, but I'm wondering if it's ok to assume observability plugin is not installed when error message is Not Found? Because Not Found sounds like a general error message.

Copy link
Collaborator Author

@raintygao raintygao Dec 12, 2023

Choose a reason for hiding this comment

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

I think we can assume they are same at this time because observability will register this route automatically if it is installed. OSD server will throw Not Found error if this route is not registered. I tried to import an error constant from OSD to avoid directly judge this string, but OSD doesn't export.

public/components/notebook/notebook_name_modal.tsx Outdated Show resolved Hide resolved
public/components/notebook/notebook_name_modal.tsx Outdated Show resolved Hide resolved
public/hooks/use_save_chat.tsx Outdated Show resolved Hide resolved
Signed-off-by: tygao <[email protected]>
@raintygao raintygao merged commit 1670183 into opensearch-project:feature/agent-framework Dec 13, 2023
10 checks passed
joshuali925 pushed a commit to joshuali925/dashboards-assistant that referenced this pull request Dec 13, 2023
* test: add test for saving to notebook

Signed-off-by: tygao <[email protected]>

* update

Signed-off-by: tygao <[email protected]>

---------

Signed-off-by: tygao <[email protected]>
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.

4 participants