2020-11-18 16:24:28 +00:00
|
|
|
const { addPointsToTrack } = require('./tracks');
|
|
|
|
const TrackInfo = require('./TrackInfo');
|
2020-11-17 17:24:13 +00:00
|
|
|
|
2020-11-18 16:24:28 +00:00
|
|
|
const { test1 } = require('./_tracks_testdata');
|
2020-11-17 17:01:29 +00:00
|
|
|
|
|
|
|
describe('addPointsToTrack', () => {
|
|
|
|
it('is a function', () => {
|
2020-11-17 17:07:32 +00:00
|
|
|
expect(typeof addPointsToTrack).toBe('function');
|
|
|
|
});
|
2020-11-17 17:24:13 +00:00
|
|
|
|
|
|
|
it('works on the sample data with an empty track', () => {
|
|
|
|
const trackInfo = new TrackInfo({}, { points: [] });
|
|
|
|
addPointsToTrack(trackInfo, test1);
|
2020-11-18 16:24:28 +00:00
|
|
|
const points = trackInfo.trackData.points;
|
2020-11-17 17:24:13 +00:00
|
|
|
expect(points).toHaveLength(324);
|
|
|
|
expect(points[0]).toEqual({
|
|
|
|
date: '12.07.2020',
|
|
|
|
time: '09:02:59',
|
|
|
|
latitude: 0,
|
|
|
|
longitude: 0,
|
|
|
|
course: 0,
|
|
|
|
speed: 0,
|
|
|
|
d1: '255',
|
|
|
|
d2: '255',
|
|
|
|
flag: '0',
|
|
|
|
private: '0',
|
|
|
|
});
|
|
|
|
});
|
2020-11-17 17:07:32 +00:00
|
|
|
});
|