From e7467ce720fdd38bfe3b51ee02f2832256b87fe4 Mon Sep 17 00:00:00 2001 From: Stephan Besser Date: Thu, 5 Dec 2024 08:19:47 +0100 Subject: [PATCH] test: add additional test cases for DmsUnsignedDelimitedSuffixedHemisphereFormat --- ...-unsigned-delimited-suffixed-hemisphere-format.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/dms-unsigned-delimited-suffixed-hemisphere-format.test.ts b/tests/dms-unsigned-delimited-suffixed-hemisphere-format.test.ts index 280733b..89b4197 100644 --- a/tests/dms-unsigned-delimited-suffixed-hemisphere-format.test.ts +++ b/tests/dms-unsigned-delimited-suffixed-hemisphere-format.test.ts @@ -4,6 +4,7 @@ import { DmsUnsignedDelimitedSuffixedHemisphereFormat } from '../src/formats/dms describe('canParse', () => { it('returns true for known formats', () => { expect(DmsUnsignedDelimitedSuffixedHemisphereFormat.canParse(`40:7:23N 74:7:23W`)).toBe(true); + expect(DmsUnsignedDelimitedSuffixedHemisphereFormat.canParse(`35:02:15 N 131:59:23 E`)).toBe(true); expect(DmsUnsignedDelimitedSuffixedHemisphereFormat.canParse(`40:7:23N74:7:23W`)).toBe(true); expect(DmsUnsignedDelimitedSuffixedHemisphereFormat.canParse(`40:7:23N, 74:7:23W`)).toBe(true); expect(DmsUnsignedDelimitedSuffixedHemisphereFormat.canParse(`40:7:23N,74:7:23W`)).toBe(true); @@ -18,6 +19,13 @@ describe('parse', () => { expect(result.longitude).toBe(-74.12306); }); + it(`returns the correct latitude and longitude for 35:02:15 N 131:59:23 E`, () => { + const formatParser = new DmsUnsignedDelimitedSuffixedHemisphereFormat(); + const result = formatParser.parse(`35:02:15 N 131:59:23 E`); + expect(result.latitude).toBe(35.0375); + expect(result.longitude).toBe(131.98972); + }); + it(`returns the correct latitude and longitude for 40:7:23N74:7:23W`, () => { const formatParser = new DmsUnsignedDelimitedSuffixedHemisphereFormat(); const result = formatParser.parse(`40:7:23N74:7:23W`);