gatsby-plugin-algolia icon indicating copy to clipboard operation
gatsby-plugin-algolia copied to clipboard

Add tests

Open Haroenv opened this issue 7 years ago • 9 comments

  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

Haroenv avatar Oct 23 '18 13:10 Haroenv

I'll see what I can do this weekend.

janosh avatar Oct 23 '18 13:10 janosh

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/?

janosh avatar Nov 12 '18 21:11 janosh

__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)

Haroenv avatar Nov 13 '18 08:11 Haroenv

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

Should I wait for further instructions then?

janosh avatar Nov 13 '18 08:11 janosh

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 :)

Haroenv avatar Nov 13 '18 08:11 Haroenv

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.

janosh avatar Nov 13 '18 08:11 janosh

(just published for you @janosh)

Haroenv avatar Nov 13 '18 08:11 Haroenv

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. :)

janosh avatar Nov 13 '18 09:11 janosh

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

Haroenv avatar Nov 13 '18 10:11 Haroenv