fix geodesic error on azimuth

This commit is contained in:
sbriat
2023-09-19 12:33:48 +02:00
parent efea6fe13c
commit 1f1502a623
8 changed files with 71 additions and 6 deletions

View File

@@ -11,4 +11,26 @@ describe('Matcher geodesic', () => {
expect(Math.round(inv.azimuth as number)).toBe(45);
expect(Math.round(inv.distance as number)).toBe(156900);
});
it('should get azimuth value', () => {
const geodesic: Geodesic = new Geodesic();
const azimuth = geodesic.azimuth(0, 0, 1, 1);
expect(Math.round(azimuth as number)).toBe(45);
});
it('should get distance value', () => {
const geodesic: Geodesic = new Geodesic();
const distance = geodesic.distance(0, 0, 1, 1);
expect(Math.round(distance as number)).toBe(156900);
});
it('should throw an exception if inverse fails', () => {
const geodesic: Geodesic = new Geodesic();
expect(() => {
geodesic.inverse(7.74547, 48.583035, 7.74547, 48.583036);
}).toThrow();
});
it('should throw an exception if azimuth fails', () => {
const geodesic: Geodesic = new Geodesic();
expect(() => {
geodesic.azimuth(7.74547, 48.583035, 7.74547, 48.583036);
}).toThrow();
});
});

View File

@@ -253,6 +253,8 @@ const mockGeodesic: GeodesicPort = {
azimuth: 45,
distance: 50000,
})),
azimuth: jest.fn().mockImplementation(() => 45),
distance: jest.fn().mockImplementation(() => 50000),
};
const mockDefaultParamsProvider: DefaultParamsProviderPort = {