From aa4122c080148d76d7d875507f733e7aa258c384 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Fri, 23 Aug 2024 22:11:05 +0300 Subject: [PATCH] Update tests --- test/unit/services/geoipservice.test.mts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/unit/services/geoipservice.test.mts b/test/unit/services/geoipservice.test.mts index 0a5881dd..90c0c109 100644 --- a/test/unit/services/geoipservice.test.mts +++ b/test/unit/services/geoipservice.test.mts @@ -36,19 +36,21 @@ describe('GeoIPService', function () { it('should handle empty responses', function () { cityReader.getWithPrefixLength.mock.mockImplementationOnce(() => [{}, 0]); - ispReader.getWithPrefixLength.mock.mockImplementationOnce(() => [{}, 0]); + ispReader.getWithPrefixLength.mock.mockImplementationOnce(() => [null, 0]); const actual = service.geolocate('1.2.3.4'); expect(actual).to.deep.equal(emptyGeoResponse); }); // eslint-disable-next-line mocha/no-setup-in-describe - [ - [cityResponseWithRepresentedCountry, geoResponseWithRepresentedCountry], - [cityResponseWithRegisteredCountry, geoResponseWithRegisteredCountry], - [cityResponseWithCountry, geoResponseWithCountry], - ].forEach(([mock, expected]) => { + ( + [ + [cityResponseWithRepresentedCountry, geoResponseWithRepresentedCountry], + [cityResponseWithRegisteredCountry, geoResponseWithRegisteredCountry], + [cityResponseWithCountry, geoResponseWithCountry], + ] as const + ).forEach(([mock, expected]) => { it('should try records in the defined order', function () { - cityReader.getWithPrefixLength.mock.mockImplementationOnce(() => [mock, 32]); + cityReader.getWithPrefixLength.mock.mockImplementationOnce(() => [mock, 32]); // NOSONAR const actual = service.geolocate('1.2.3.4'); expect(actual).to.deep.equal(expected); });