Add tests for utils.normailze

pull/54/head
Christian Paul 2018-11-18 19:22:39 -08:00
rodzic 9ef0d88d55
commit 62440a98b8
1 zmienionych plików z 22 dodań i 0 usunięć

Wyświetl plik

@ -23,3 +23,25 @@ describe('utils', () => {
});
});
});
describe('normalize', () => {
describe.each([
[0, 0, 0, 0],
[61, 48, 61, 48],
[-61, -48, -61, -48],
[181, 85.06, -179, 85.0511],
[-181, -85.06, 179, -85.0511],
])('when given lon=%f and lat=%f', (lon, lat, expected_lon, expected_lat) => {
const input = {
lon,
lat,
};
test(`returns lon=${expected_lon} and lat=${expected_lat}`, () => {
const expected = {
lon: expected_lon,
lat: expected_lat,
};
expect(utils.normalize(input)).toEqual(expected);
});
});
});