Skip to content

Commit

Permalink
test: add partial test for read pb
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Apr 4, 2023
1 parent 8fec8bc commit d1a2592
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/map/utils/parsePB.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('!')
Expand Down
41 changes: 37 additions & 4 deletions test/map/utils/read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
});

0 comments on commit d1a2592

Please sign in to comment.