-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for function reliant on turf dependency #769
Labels
Comments
cafca
added
help wanted
Extra attention is needed
good first issue
Good for newcomers
labels
Feb 9, 2021
@s-pic I will not be able to help much (not knowing this part of the code yet and not being "fluent" in unit tests, yet :)), but yes, feel free. CC @ohrie. package.json:
42 "@material-ui/styles": "^4.11.4",
43: "@turf/along": "6.0.1",
44: "@turf/boolean-within": "^6.0.1",
45: "@turf/center": "^6.3.0",
46: "@turf/helpers": "^6.1.4",
47: "@turf/length": "^6.3.0",
48 "abortcontroller-polyfill": "^1.7.3",
src/apps/Gastro/components/AreaMap.tsx:
1: import turfCenter from '@turf/center';
2 import MapboxGL, { LngLatLike } from 'mapbox-gl';
43 if (showAreaPin) {
44: const center = turfCenter(area);
45 new MapboxGL.Marker({ color: config.colors.interaction })
src/apps/Map/map-utils.ts:
1: import turfAlong from '@turf/along';
2: import { lineString as turfLineString } from '@turf/helpers';
3: import turfLength from '@turf/length';
4 import debug from 'debug';
191 if (geometry.type === 'MultiLineString') {
192: lineString = turfLineString(
193 geometry.coordinates.reduce((res, coord) => res.concat(coord)),
197
198: const length = turfLength(lineString);
199: return turfAlong(lineString, length * 0.5).geometry.coordinates;
200 }
src/pages/Reports/state/SubmitReportState.js:
1 /* eslint-disable no-multi-spaces */
2: import booleanWithin from '@turf/boolean-within';
3 |
Nice. Will try to add proper types (get rid of the |
s-pic
added a commit
that referenced
this issue
Jan 20, 2022
that actually tests the calculation using a simple example. Goal is to detect regressions caused by updating the turf.js version closes #769
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are using turf only for this single piece of code and therefore are not tracking changes in turf releases. To guard against breaking api changes in future turf releases etc. we should add a test for this function.
fixmy.frontend/src/apps/Map/map-utils.js
Lines 176 to 190 in e9ed240
This is a good issue for first contributors. Please leave a message here if you would like assistance.
The text was updated successfully, but these errors were encountered: