Add tests for utils.normailze

This commit is contained in:
Christian Paul 2018-11-18 19:22:39 -08:00
parent 9ef0d88d55
commit 62440a98b8

View File

@ -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);
});
});
});