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 Unit Testing #6

Open
devcshort opened this issue Sep 25, 2020 · 18 comments
Open

Add Unit Testing #6

devcshort opened this issue Sep 25, 2020 · 18 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@devcshort
Copy link
Owner

This repo needs to have proper testing put in place to ensure the stability of future releases.

@devcshort devcshort added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers Hacktoberfest labels Sep 25, 2020
@aortiz24
Copy link

This would be my first Hacktoberfest issue! I'll look into React Unit Testing if you'll assign me the issue.

@devcshort
Copy link
Owner Author

That would be great @aortiz24 ! 🙂

@aortiz24
Copy link

aortiz24 commented Sep 30, 2020

Jest and Enzyme seem to be the go-to tools for React Unit Testing. Jest will help do all assertions and enzyme will help render React components in testing mode.

The link below explains the two tools and gives example code.
https://itnext.io/how-to-unit-test-in-react-72e911e2b8d

@devcshort, what are your specific goals regarding the unit testing issue?
I am new to unit testing :)

@devcshort
Copy link
Owner Author

@aortiz24 I'm actually new to unit testing as well. Ideally, I'd like to have automated testing of the react-hls-player component with several different scenarios. I don't want to accidentally push changes that break the entire package when deployed. At some point once CI/CD is set up, would like to have the tests run and then automatically deploy the package.

@aortiz24
Copy link

@devcshort, if you create another issue for CI/CD setup and assign me to that issue. I'll help with CI/CD setup. I've found a medium article that guides through the process: https://medium.com/bettercode/how-to-build-a-modern-ci-cd-pipeline-5faa01891a5b

@devcshort
Copy link
Owner Author

@aortiz24 unfortunately I have someone assigned to CI/CD already :(

@aortiz24
Copy link

aortiz24 commented Sep 30, 2020

I'm going to do some more investigating! @devcshort, What would those different scenarios be in regards to the automated testing of the react-hls-player component? It will help me in my research :)

@aortiz24
Copy link

aortiz24 commented Oct 1, 2020

Hey @devcshort , I have confirmed from multiple sources that Jest and Enzyme are the go-to tools for React Unit Testing! Cypress is used for everything else :)

@devcshort
Copy link
Owner Author

Hi @aortiz24 sorry for not getting back to you sooner, was a busy day yesterday evening! Yes, I believe Jest and Enzyme would be the best and easiest to use for now. May look in to Cypress at a later point.

@aortiz24
Copy link

aortiz24 commented Oct 1, 2020

No worries @devcshort! I did some more research and found that Jest alone can do the unit testing. This is a short & sweet 12 minute breakdown (11:07 - 23:09) of unit testing here: https://www.youtube.com/watch?v=r9HdJ8P6GQI The video is for people who are new to unit testing!

@aortiz24
Copy link

aortiz24 commented Oct 1, 2020

Do you have a util.js? If not, I can make one with your guidance on what you would like unit tested.

Would you like me to make a util.test.js?

@devcshort
Copy link
Owner Author

I don't currently have one, if you'd like to make one, that'd be great :)

@aortiz24
Copy link

aortiz24 commented Oct 2, 2020

Okay, sounds good.

Could you share with me your util.js file where you have written the functions you want unit tested.

Based on that util.js file, I can write the util.test.js file.

@devcshort
Copy link
Owner Author

I don't have a util.js file. I believe the only thing we need to test is the main video component to make sure it renders using commonly used props.

@aortiz24
Copy link

aortiz24 commented Oct 3, 2020

Hey @devcshort, I've learned a lot by trying to work on this issue, but I can no longer devote the time to it. Best of luck!

@aortiz24 aortiz24 removed their assignment Oct 3, 2020
@osmarpetry
Copy link

Anyone already is on this task? If yes, let talk about @testing-library? If not, I will try something with it

@devcshort
Copy link
Owner Author

@osmarpetry the last person wasn't able to continue on this, but if you'd like to give it a try then that'd be great. I'm not familiar with testing so if you have any ideas, I'm all ears

@gnatal
Copy link

gnatal commented Oct 19, 2022

Hi I found out a fix can I do a PR ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants