kaicataldo / eleventy-plugin-react

A plugin that allows you to use React as a templating language for Eleventy
MIT License
37 stars 4 forks source link

Internal: Add tests #10

Open kaicataldo opened 3 years ago

kaicataldo commented 3 years ago

Now that the feature set is stabilizing a bit, the plugin desperately needs tests. Any help is appreciated!

dpfavand commented 3 years ago

Do you have any preferences for testing library?

Jest + testing-library/react seems like a pretty common combination that probably has a relatively low learning curve for contributors.

kaicataldo commented 3 years ago

Yeah, that does seem pretty common in the React world! Makes sense to test the withHydration HOC and the hydrated bundle. What I was initially thinking was:

  1. Unit testing withHydration
  2. Integration tests where we run the Eleventy build (maybe a nested full project with a package.json and everything?) and then assert that the generated files have the expected content. We could then load up the site in a headless browser and make assertions about the hydrated component behavior.

Thoughts?