From 6dbec51511e608214b9e7698ce4d6d86b45ac192 Mon Sep 17 00:00:00 2001 From: kamataryo <6292312+kamataryo@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:31:20 +0900 Subject: [PATCH] Add a test --- test/advanced/interface_v2.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/advanced/interface_v2.test.ts b/test/advanced/interface_v2.test.ts index b8f3bfc470..556945d2ec 100644 --- a/test/advanced/interface_v2.test.ts +++ b/test/advanced/interface_v2.test.ts @@ -46,6 +46,7 @@ config.transformRequest = async (url, query) => { return [ { addr: '1-1', lat: '30.1', lng: '135.1' }, { addr: '1-2', lat: '30.2', lng: '135.2' }, + { addr: '2-3', lat: null, lng: null }, ] } } @@ -86,3 +87,19 @@ test('リクエスト変形テスト 2', async () => { lat: 30.2, }) }) + +test('リクエスト変形テスト - レベル8 で緯度経度が null の時はレベル3の緯度経度を使う', async () => { + const res = await normalize('A県 X市 あああ 2の3 こんばんはビル', { + level: 8, + }) + expect(res).toStrictEqual({ + pref: 'A県', + city: 'X市', + town: 'あああ', + addr: '2-3', + other: 'こんばんはビル', + lng: 135, + level: 8, + lat: 30, + }) +})