diff --git a/test/map/utils/parsePB.test.ts b/test/map/utils/parsePB.test.ts index e5ccace..ded3af9 100644 --- a/test/map/utils/parsePB.test.ts +++ b/test/map/utils/parsePB.test.ts @@ -81,7 +81,7 @@ describe.concurrent('Parse PB', () => { expect(res).toBe(`11°11'11.1"N 11°11'11.1"E`); }); - it('real world example', ({ expect }) => { + it('"real" world example', ({ expect }) => { const splitted = '!1m14!1m12!1m3!1d1.1!2d1.1!3d1.1!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sde!2sde!4v1680097499131!5m2!1sde!2sde' .split('!') diff --git a/test/map/utils/read.test.ts b/test/map/utils/read.test.ts index f1b5dcc..38d840f 100644 --- a/test/map/utils/read.test.ts +++ b/test/map/utils/read.test.ts @@ -2,14 +2,47 @@ import { describe, it } from 'vitest'; import { readPB, readQ } from '../../../src/map/utils/read'; describe.concurrent('read pb', () => { - it('', async ({ expect }) => { - const req = readPB(''); + it('read example', async ({ expect }) => { + const res = await readPB( + '!1m14!1m12!1m3!1d1.1!2d1.1!3d1.1!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sde!2sde!4v1680097499131!5m2!1sde!2sde' + ); + + expect(res).toStrictEqual({ + area: { + lat: 1.1, + lon: 1.1, + }, + markers: [], + tile: 'roadmap', + zoom: 19, + }); }); -}); + it('pb markers', async ({ expect }) => { + const res = await readPB( + '!1m17!1m12!1m3!1d1.1!2d1.1!3d1.1!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m2!1m1!1zMTDCsDYwJzM2LjAiTiAxMMKwNjAnMzYuMCJF!5e0!3m2!1sde!2sde!4v1557583694739!5m2!1sde!2sde' + ); + + expect(res).toStrictEqual({ + area: { + lat: 1.1, + lon: 1.1, + }, + markers: [ + { + label: '11.01 11.01', + lat: 11.01, + lon: 11.01, + }, + ], + tile: 'roadmap', + zoom: 19, + }); + }); +}); describe.concurrent('read query', () => { it('', async ({ expect }) => { - const req = readQ(''); // TODO: Mocking requests + const res = readQ(''); // TODO: Mocking requests }); });