caricovidsite icon indicating copy to clipboard operation
caricovidsite copied to clipboard

Tests!

Open luvi opened this issue 5 years ago • 2 comments

Healthy Code, Healthy Tests! Unfortunately there are no tests to be found anywhere in this repo, as it started out as a just a proof of concept but has turned into a full fledged project. At least one test on basic functionality is needed.

luvi avatar Aug 10 '20 20:08 luvi

I would love to work on this. Can you assign this issue to me?

murt202 avatar Oct 12 '20 17:10 murt202

Running jest on the current project seems to be a bit tricky with mapbox-gl.

I was able to get the basic test working by creating a file __mocks__/mapbox-gl.js:

module.exports = {
  GeolocateControl: jest.fn(),
  Map: jest.fn(() => ({
    addControl: jest.fn(),
    on: jest.fn(),
    remove: jest.fn()
  })),
  NavigationControl: jest.fn()
};

and running npm test.

While this requires a bit more work as it shows some problems in the code, I did not add this to #22.

I hope this helps a bit @murt202 and I am looking forward to some more tests.

grische avatar Oct 17 '20 17:10 grische