diff --git a/src/lib/geoip/client.ts b/src/lib/geoip/client.ts index e2141219..a58121b2 100644 --- a/src/lib/geoip/client.ts +++ b/src/lib/geoip/client.ts @@ -91,8 +91,8 @@ export default class GeoipClient { region: match.region, normalizedCity: match.normalizedCity, asn: Number(networkMatch.asn), - latitude: Number(match.latitude), - longitude: Number(match.longitude), + latitude: Math.round(Number(match.latitude) * 100) / 100, + longitude: Math.round(Number(match.longitude) * 100) / 100, network: networkMatch.network, normalizedNetwork: networkMatch.normalizedNetwork, isHosting, diff --git a/test/tests/integration/adoption-code.test.ts b/test/tests/integration/adoption-code.test.ts index 61b11488..b0b74681 100644 --- a/test/tests/integration/adoption-code.test.ts +++ b/test/tests/integration/adoption-code.test.ts @@ -50,8 +50,8 @@ describe('Adoption code', () => { city: 'Dallas', state: 'TX', country: 'US', - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, asn: 20004, network: 'The Constant Company LLC', }); diff --git a/test/tests/integration/measurement/probe-communication.test.ts b/test/tests/integration/measurement/probe-communication.test.ts index e3c44128..883a4c93 100644 --- a/test/tests/integration/measurement/probe-communication.test.ts +++ b/test/tests/integration/measurement/probe-communication.test.ts @@ -70,8 +70,8 @@ describe('Create measurement request', () => { city: 'Dallas', normalizedCity: 'dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', }]); @@ -127,8 +127,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - longitude: -96.8067, - latitude: 32.7831, + longitude: -96.81, + latitude: 32.78, network: 'The Constant Company LLC', tags: [ 'gcp-us-west4', 'datacenter-network' ], resolvers: [], @@ -173,8 +173,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - longitude: -96.8067, - latitude: 32.7831, + longitude: -96.81, + latitude: 32.78, network: 'The Constant Company LLC', tags: [ 'gcp-us-west4', 'datacenter-network' ], resolvers: [], @@ -214,8 +214,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - longitude: -96.8067, - latitude: 32.7831, + longitude: -96.81, + latitude: 32.78, network: 'The Constant Company LLC', tags: [ 'gcp-us-west4', 'datacenter-network' ], resolvers: [], @@ -268,8 +268,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - longitude: -96.8067, - latitude: 32.7831, + longitude: -96.81, + latitude: 32.78, network: 'The Constant Company LLC', tags: [ 'gcp-us-west4', 'datacenter-network' ], resolvers: [], @@ -344,8 +344,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', }, tags: [ 'gcp-us-west4', 'datacenter-network' ], @@ -394,8 +394,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', }, tags: [ 'gcp-us-west4', 'datacenter-network' ], @@ -437,8 +437,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', }, tags: [ 'gcp-us-west4', 'datacenter-network' ], @@ -480,8 +480,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', }, tags: [ 'gcp-us-west4', 'datacenter-network' ], @@ -523,8 +523,8 @@ describe('Create measurement request', () => { state: 'TX', city: 'Dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', }, tags: [ 'gcp-us-west4', 'datacenter-network' ], diff --git a/test/tests/integration/probes/get-probes.test.ts b/test/tests/integration/probes/get-probes.test.ts index 183500da..8974aaf3 100644 --- a/test/tests/integration/probes/get-probes.test.ts +++ b/test/tests/integration/probes/get-probes.test.ts @@ -79,8 +79,8 @@ describe('Get Probes', () => { state: null, city: 'Buenos Aires', asn: 61004, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', }, tags: [], @@ -95,8 +95,8 @@ describe('Get Probes', () => { state: 'TX', city: 'Dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', }, tags: [ 'datacenter-network' ], @@ -111,8 +111,8 @@ describe('Get Probes', () => { state: 'NY', city: 'New York', asn: 80004, - latitude: 40.7143, - longitude: -74.0060, + latitude: 40.71, + longitude: -74.01, network: 'The Constant Company LLC', }, tags: [ 'datacenter-network' ], @@ -125,8 +125,8 @@ describe('Get Probes', () => { city: 'Washington', continent: 'NA', country: 'US', - latitude: 38.89539, - longitude: -77.039476, + latitude: 38.90, + longitude: -77.04, network: 'Verizon Business', region: 'Northern America', state: 'DC', @@ -162,8 +162,8 @@ describe('Get Probes', () => { state: null, city: 'Buenos Aires', asn: 61004, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', }, tags: [], @@ -201,8 +201,8 @@ describe('Get Probes', () => { state: null, city: 'Buenos Aires', asn: 61004, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', }, stats: { cpu: { load: [] }, jobs: { count: 0 } }, @@ -243,8 +243,8 @@ describe('Get Probes', () => { state: null, city: 'Buenos Aires', asn: 61004, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', }, status: 'ready', diff --git a/test/tests/unit/geoip/client.test.ts b/test/tests/unit/geoip/client.test.ts index 628f4172..b6c09f7b 100644 --- a/test/tests/unit/geoip/client.test.ts +++ b/test/tests/unit/geoip/client.test.ts @@ -28,8 +28,8 @@ describe('geoip service', () => { region: 'South America', normalizedCity: 'buenos aires', asn: 61003, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', normalizedNetwork: 'interbs s.r.l. (baehost)', isHosting: true, @@ -53,8 +53,8 @@ describe('geoip service', () => { region: 'South America', normalizedCity: 'buenos aires', asn: 61004, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', normalizedNetwork: 'interbs s.r.l. (baehost)', isHosting: null, @@ -74,8 +74,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20005, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -95,8 +95,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20005, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -116,8 +116,8 @@ describe('geoip service', () => { region: 'South America', normalizedCity: 'buenos aires', asn: 61004, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', normalizedNetwork: 'interbs s.r.l. (baehost)', isHosting: true, @@ -137,8 +137,8 @@ describe('geoip service', () => { region: 'South America', normalizedCity: 'buenos aires', asn: 61001, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', normalizedNetwork: 'interbs s.r.l. (baehost)', isHosting: null, @@ -171,8 +171,8 @@ describe('geoip service', () => { region: 'Northern Africa', normalizedCity: 'el-rashda', asn: 20001, - latitude: 23.878, - longitude: 26.487, + latitude: 23.88, + longitude: 26.49, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -192,8 +192,8 @@ describe('geoip service', () => { region: 'Western Europe', normalizedCity: 'falkenstein', asn: 24940, - latitude: 50.47785, - longitude: 12.371563, + latitude: 50.48, + longitude: 12.37, network: 'Hetzner Online GmbH', normalizedNetwork: 'hetzner online gmbh', isHosting: null, @@ -213,8 +213,8 @@ describe('geoip service', () => { region: 'Western Europe', normalizedCity: 'zwickau', asn: 24940, - latitude: 50.47785, - longitude: 12.371563, + latitude: 50.48, + longitude: 12.37, network: 'Hetzner Online GmbH', normalizedNetwork: 'hetzner online gmbh', isHosting: null, @@ -234,8 +234,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: true, @@ -255,8 +255,8 @@ describe('geoip service', () => { region: 'South America', normalizedCity: 'buenos aires', asn: 61003, - latitude: -34.6131, - longitude: -58.3772, + latitude: -34.61, + longitude: -58.38, network: 'InterBS S.R.L. (BAEHOST)', normalizedNetwork: 'interbs s.r.l. (baehost)', isHosting: null, @@ -276,8 +276,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'new york', asn: 80004, - latitude: 40.7143, - longitude: -74.0060, + latitude: 40.71, + longitude: -74.01, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: true, @@ -297,8 +297,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20005, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -319,8 +319,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20005, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -340,8 +340,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20005, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -361,8 +361,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20005, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: null, @@ -382,8 +382,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'washington', asn: 40676, - latitude: 38.89539, - longitude: -77.039476, + latitude: 38.90, + longitude: -77.04, network: 'Psychz Networks', normalizedNetwork: 'psychz networks', isHosting: true, @@ -401,8 +401,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'washington', asn: 701, - latitude: 38.89539, - longitude: -77.039476, + latitude: 38.90, + longitude: -77.04, network: 'Verizon Business', normalizedNetwork: 'verizon business', isHosting: null, @@ -436,8 +436,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: true, @@ -457,8 +457,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: true, @@ -486,8 +486,8 @@ describe('geoip service', () => { region: 'Northern America', normalizedCity: 'dallas', asn: 20004, - latitude: 32.7831, - longitude: -96.8067, + latitude: 32.78, + longitude: -96.81, network: 'The Constant Company LLC', normalizedNetwork: 'the constant company llc', isHosting: true,