publiclab / leaflet-blurred-location

A Leaflet-based interface for selecting a "blurred" or low-resolution location, to preserve privacy
https://publiclab.github.io/leaflet-blurred-location/examples/
GNU General Public License v3.0
35 stars 32 forks source link

Better testing for different features, especially interface code #119

Open jywarren opened 6 years ago

jywarren commented 6 years ago

This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!


We're occasionally seeing features get broken by later additions, especially UI features which are harder to test. But we do have UI tests in Jasmine:

https://github.com/publiclab/leaflet-blurred-location/blob/c7f4ebb72657ba456150dd965633ba5d1824c4c3/spec/javascripts/ui_spec.js#L4-L14

Let's add some more -- checking that, for example, different fields update correctly when the map is panned. Let's look at the events that trigger behaviors in our interface code:

https://github.com/publiclab/leaflet-blurred-location/blob/c7f4ebb72657ba456150dd965633ba5d1824c4c3/src/ui/Interface.js#L38

And add some UI tests to ensure these actually happen -- that way our code will be less brittle when new changes are added!

Any help with this much appreciated!

mridulnagpal commented 6 years ago

@jywarren I can try breaking it to first timer issue

mridulnagpal commented 6 years ago

@jywarren Do you have any other UI tests in mind? I will create FTOs for the same

mridulnagpal commented 6 years ago

@jywarren We have basic UI tests, do you have any more in mind?

jywarren commented 6 years ago

We might add one to try to simulate the steps described in https://github.com/publiclab/leaflet-blurred-location/issues/105 -- i.e. move to a location using a Leaflet panTo() command, then use jQuery to uncheck the "blurred" checkbox, then use panTo() again, and see if we can use the test to demonstrate that the displayed fields are not properly truncated. This would be a great test!

mridulnagpal commented 6 years ago

Will add a test for isBlurred as soon as the PR is merged

mridulnagpal commented 6 years ago

@jywarren Added a test #138

mridulnagpal commented 6 years ago

@jywarren adding test for newly added scale!!

jywarren commented 5 years ago

I also just turned on test coverage reporting in CodeClimate!