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 tests for existing functionality #134

Open
nazmulidris opened this issue Sep 19, 2023 · 2 comments
Open

Add tests for existing functionality #134

nazmulidris opened this issue Sep 19, 2023 · 2 comments
Assignees
Labels
component: tuify good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed test Make codebase more robust, increase code coverage

Comments

@nazmulidris
Copy link
Member

nazmulidris commented Sep 19, 2023

tuify folder

@0xkelvin
Copy link

@nazmulidris
i am new to base source, could you please address which are functionality that need to add test.
i mean i should start somewhere, to get familiar with the source code

willing to help

@nazmulidris
Copy link
Member Author

@0xkelvin Thank you. Here is a good place to get started to get a handle on terminals and TUIs: https://github.com/r3bl-org/onboarding

In the current tuify codebase we have tests in the following files:

  1. https://github.com/r3bl-org/r3bl_rs_utils/blob/main/tuify/src/components/select_component.rs#L213
  2. https://github.com/r3bl-org/r3bl_rs_utils/blob/main/tuify/src/scroll.rs#L128

There need to more tests to check things that a user would perform, such as try and select a single item. There's the happy path. Where they have a few items and enough display viewport size to see them all without scrolling. Then they make their selection or not, and we are done.

  • In these cases the tests can check whether moving up and down w/ the cursor is working.
  • Whether things are rendered correctly as the focus state changes.
  • And finally if the selection actually selects the right thing.

You can see in some tests the following trait is mocked https://github.com/r3bl-org/r3bl_rs_utils/blob/main/tuify/src/components/select_component.rs#L26 so that you can check what its contents are (very similar to ReactJS snapshot tests). In these cases, it is important to override the color support, since we run all tests in CI/CD and they don't all support color output. This is done in one of the tests listed above.

Here are all the paths that I've been manually testing:
https://github.com/r3bl-org/r3bl_rs_utils/blob/main/tuify/examples/main_interactive.rs#L53

It would be great to automate those testing paths.

PLMK if you have any questions 👍🏽 . And we have a discord server if you would like to chat (more sync than async like issues) about the issue or PR.

@NadiaIdris NadiaIdris added the test Make codebase more robust, increase code coverage label Nov 25, 2023
@NadiaIdris NadiaIdris changed the title [tuify] Add tests for existing functionality Add tests for existing functionality Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tuify good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed test Make codebase more robust, increase code coverage
Projects
None yet
Development

No branches or pull requests

3 participants