test: add test data from postman-test to test addPointsToTrack
This commit is contained in:
parent
04f597cfb1
commit
8f5237a182
4
logic/_tracks_testdata.js
Normal file
4
logic/_tracks_testdata.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,29 @@
|
||||||
var { addPointsToTrack } = require('./tracks');
|
var { addPointsToTrack } = require('./tracks');
|
||||||
|
var TrackInfo = require('./TrackInfo');
|
||||||
|
|
||||||
|
var { test1 } = require('./_tracks_testdata');
|
||||||
|
|
||||||
describe('addPointsToTrack', () => {
|
describe('addPointsToTrack', () => {
|
||||||
it('is a function', () => {
|
it('is a function', () => {
|
||||||
expect(typeof addPointsToTrack).toBe('function');
|
expect(typeof addPointsToTrack).toBe('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('works on the sample data with an empty track', () => {
|
||||||
|
const trackInfo = new TrackInfo({}, { points: [] });
|
||||||
|
addPointsToTrack(trackInfo, test1);
|
||||||
|
var points = trackInfo.trackData.points;
|
||||||
|
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',
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue