benwiley4000 / cassette

📼 A flexible media player component library for React that requires no up-front config
https://benwiley4000.github.io/cassette/styleguide
MIT License
183 stars 28 forks source link

Needs tests #35

Open benwiley4000 opened 7 years ago

benwiley4000 commented 7 years ago

We could use some component tests, as the API has become a bit complex to validate changes just by loading example.html in a web browser.

benwiley4000 commented 5 years ago

If you're here from Hacktoberfest you can also help out by adding documentation! 😃

benwiley4000 commented 5 years ago

@danielr18 I've push a branch called in-progress-test-setup. I worked on it a few nights ago. It has a small example snapshot test and jest configuration. However it seems like the JSX transform isn't working. Not sure what I did wrong, and I was too tired to spend more time on it. I can look again sometime but if you have any idea and want to help out, that would be appreciated. :) If not, I'll get to it eventually.

If you want to check it out locally you'll need to run:

git checkout in-progress-test-setup
$(npm bin)/lerna bootstrap # installs all the test dependencies
npm test
danielr18 commented 5 years ago

I think it's because babel.config.js support was added on babel 7 beta 46, and we are currently at 41. I'll update babel 7 packages and push the changes if I get JSX working.

benwiley4000 commented 5 years ago

Ah!! You're probably right, I forgot I was still on an old beta version.

benwiley4000 commented 5 years ago

Jest stuff is now merged into the next branch. I've added one passing snapshot test for now, as a starting point. Obviously we want more coverage. :) I'll leave this issue open until we get there.

benwiley4000 commented 5 years ago

This comment was originally posted here but makes more sense in the general testing issue:


I think Jest is a good tool to use. I could use some help brainstorming, but here's a starter checklist:

Component snapshot tests

@cassette/player

Each of these should be wrapped in context providers with mock values (the actual Context.Provider, not the smart wrapper):

Mocking stuff from the browser will be an issue to resolve.

benwiley4000 commented 5 years ago

These tests don't need to be done before the beta release is out. They can be part of the beta stabilization phase.