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

Implemented tests for @optuna/react #860

Merged
merged 10 commits into from
Apr 10, 2024

Conversation

porink0424
Copy link
Collaborator

@porink0424 porink0424 commented Apr 5, 2024

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

What does this implement/fix? Explain your changes.

  • For implementing the component tests, some modules added:
    • vitest + @testing-library/react
    • jsdom for test environment
    • @testing-library/jest-dom for toBeInTheDocument method
  • Added tests to typescript-tests.yml
  • Some problems fixed in loadJournalStorage in @optuna/storage:
    • Made it possible to replace NaN/Infinity values with strings when parsing fails when they cannot be parsed with JSON.parse()
    • In case of JournalOperation.SET_TRIAL_STATE_VALUES, changed implementation so that, when the value is null, it is replaced with undefined according to the original type definition

Reference

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.51%. Comparing base (7baa0b3) to head (ac20f25).
Report is 8 commits behind head on main.

❗ Current head ac20f25 differs from pull request most recent head de0accd. Consider uploading reports for the commit de0accd to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #860   +/-   ##
=======================================
  Coverage   69.51%   69.51%           
=======================================
  Files          35       35           
  Lines        2375     2375           
=======================================
  Hits         1651     1651           
  Misses        724      724           

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

@c-bata c-bata self-assigned this Apr 8, 2024
Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

LGTM with a nit.

tslib/react/test/TrialTable.test.tsx Outdated Show resolved Hide resolved
tslib/react/test/PlotHistory.test.tsx Outdated Show resolved Hide resolved
@@ -340,7 +340,31 @@ const loadJournalStorage = (arrayBuffer: ArrayBuffer): Optuna.Study[] => {
if (log === "") {
continue
}
const parsedLog: JournalOpBase = JSON.parse(log)

const parsedLog: JournalOpBase = (() => {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some tests to check this change in the following pull request?
https://github.com/optuna/optuna-dashboard/blob/main/tslib/storage/test/journal.test.mjs

@porink0424
Copy link
Collaborator Author

@c-bata
Thank you for your suggestions, I have modified them!

@c-bata c-bata merged commit 7e9db28 into optuna:main Apr 10, 2024
17 checks passed
@porink0424 porink0424 mentioned this pull request Apr 10, 2024
1 task
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.

None yet

2 participants