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

Commit d993921

Browse files
committed
fixing undefined lat/long filtering
1 parent 2b3b163 commit d993921

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/worldmap.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,23 @@ describe('Worldmap', () => {
296296
});
297297
});
298298

299+
describe('when there is not lat/long', () => {
300+
beforeEach(() => {
301+
let data = new DataBuilder().build();
302+
data.push ({
303+
"key": "undefined_undefined",
304+
"locationName": "US",
305+
"value": 2535200,
306+
"valueFormatted": 2535200
307+
})
308+
ctrl.data = data
309+
});
310+
311+
it('should not crash', () => {
312+
expect(() => worldMap.drawCircles()).not.toThrowError();
313+
});
314+
});
315+
299316
describe('when three thresholds are set', () => {
300317
beforeEach(() => {
301318
ctrl.data = new DataBuilder().withThresholdValues([2, 4, 6]).build();

src/worldmap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default class WorldMap {
128128
createCircles(data) {
129129
const circles: any[] = [];
130130
data.forEach(dataPoint => {
131-
if (!dataPoint.locationName) {
131+
if (!dataPoint.locationName || !dataPoint.locationLatitude || !dataPoint.locationLongitude) {
132132
return;
133133
}
134134
circles.push(this.createCircle(dataPoint));

0 commit comments

Comments
 (0)