Skip to content

Commit d1a2592

Browse files
committed
test: add partial test for read pb
1 parent 8fec8bc commit d1a2592

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

test/map/utils/parsePB.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe.concurrent('Parse PB', () => {
8181
expect(res).toBe(`11°11'11.1"N 11°11'11.1"E`);
8282
});
8383

84-
it('real world example', ({ expect }) => {
84+
it('"real" world example', ({ expect }) => {
8585
const splitted =
8686
'!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'
8787
.split('!')

test/map/utils/read.test.ts

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,47 @@ import { describe, it } from 'vitest';
22
import { readPB, readQ } from '../../../src/map/utils/read';
33

44
describe.concurrent('read pb', () => {
5-
it('', async ({ expect }) => {
6-
const req = readPB('');
5+
it('read example', async ({ expect }) => {
6+
const res = await readPB(
7+
'!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'
8+
);
9+
10+
expect(res).toStrictEqual({
11+
area: {
12+
lat: 1.1,
13+
lon: 1.1,
14+
},
15+
markers: [],
16+
tile: 'roadmap',
17+
zoom: 19,
18+
});
719
});
8-
});
920

21+
it('pb markers', async ({ expect }) => {
22+
const res = await readPB(
23+
'!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'
24+
);
25+
26+
expect(res).toStrictEqual({
27+
area: {
28+
lat: 1.1,
29+
lon: 1.1,
30+
},
31+
markers: [
32+
{
33+
label: '11.01 11.01',
34+
lat: 11.01,
35+
lon: 11.01,
36+
},
37+
],
38+
tile: 'roadmap',
39+
zoom: 19,
40+
});
41+
});
42+
});
1043

1144
describe.concurrent('read query', () => {
1245
it('', async ({ expect }) => {
13-
const req = readQ(''); // TODO: Mocking requests
46+
const res = readQ(''); // TODO: Mocking requests
1447
});
1548
});

0 commit comments

Comments
 (0)