Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
fixing undefined lat/long filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsaway committed Aug 10, 2021
1 parent 2b3b163 commit d993921
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/worldmap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,23 @@ describe('Worldmap', () => {
});
});

describe('when there is not lat/long', () => {
beforeEach(() => {
let data = new DataBuilder().build();
data.push ({
"key": "undefined_undefined",
"locationName": "US",
"value": 2535200,
"valueFormatted": 2535200
})
ctrl.data = data
});

it('should not crash', () => {
expect(() => worldMap.drawCircles()).not.toThrowError();
});
});

describe('when three thresholds are set', () => {
beforeEach(() => {
ctrl.data = new DataBuilder().withThresholdValues([2, 4, 6]).build();
Expand Down
2 changes: 1 addition & 1 deletion src/worldmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class WorldMap {
createCircles(data) {
const circles: any[] = [];
data.forEach(dataPoint => {
if (!dataPoint.locationName) {
if (!dataPoint.locationName || !dataPoint.locationLatitude || !dataPoint.locationLongitude) {
return;
}
circles.push(this.createCircle(dataPoint));
Expand Down

0 comments on commit d993921

Please sign in to comment.