UNPKG

@sports-alliance/sports-lib

Version:

A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc

36 lines (35 loc) 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); describe('Device', () => { it('should preserve zero-valued numeric fields when exporting to JSON', () => { const device = new device_1.Device('bike computer'); device.index = 0; device.batteryLevel = 0; device.batteryVoltage = 0; device.product = 0; device.antDeviceNumber = 0; device.antTransmissionType = 0; device.cumOperatingTime = 0; expect(device.toJSON()).toEqual({ type: 'bike computer', name: null, index: 0, batteryStatus: null, batteryLevel: 0, batteryVoltage: 0, manufacturer: null, serialNumber: null, product: 0, swInfo: null, hwInfo: null, antDeviceNumber: 0, antTransmissionType: 0, antNetwork: null, sourceType: null, antId: null, cumOperatingTime: 0, timestamp: null }); }); });