algolia / gatsby-plugin-algolia

A plugin to push to Algolia based on graphQl queries
https://yarn.pm/gatsby-plugin-algolia
Apache License 2.0
177 stars 45 forks source link

Add tests #18

Open Haroenv opened 5 years ago

Haroenv commented 5 years ago
  1. add jest to the project
  2. test function with all Gatsby parts being mocked (algoliasearch the module should also be mocked)
  3. think of a proper e2e test later

These are the steps I'm thinking of. @janosh, you said you were interested in contributing, these are the steps I was thinking of

janosh commented 5 years ago

I'll see what I can do this weekend.

janosh commented 5 years ago

Sorry for the delay. Couldn't find any time until now. Where do you want the tests to be located? Inside their own tests/ directory? And what do you mean with

test function with all Gatsby parts being mocked (algoliasearch the module should also be mocked)

Are you thinking of tests that use the example/?

Haroenv commented 5 years ago

__tests__ is the name we usually use :) I'm not exactly sure what the best way to do it yet. But I meant mocking algoliasearch over all the tests, and just calling our hook with fake input (all mocked too)

janosh commented 5 years ago

I'm not exactly sure what the best way to do it yet.

Should I wait for further instructions then?

Haroenv commented 5 years ago

It depends if you really want to contribute or not. I won't have time for this for the time coming, but will eventually get back to it :)

janosh commented 5 years ago

I'm happy to help but I don't have a clear idea of what to test and how myself either. Personally, I'm mostly interested in getting the settings PR out (#17) since I'm using gatsby-plugin-algolia across 4 different projects now and would like to avoid switching to my personal fork in all of them.

Haroenv commented 5 years ago

(just published for you @janosh)

janosh commented 5 years ago

Nice! Thank you very much. My offer to help with testing still stands, of course. I merged upstream master into my fork and installed jest so I'm ready to go. :)

Haroenv commented 5 years ago

all context I have so far is in the thread, you can let me know how far you got :)