From c3295376ac4d638682fb551a6e55f9e0dc0e23e1 Mon Sep 17 00:00:00 2001 From: Miguel Matey Sanz Date: Wed, 11 May 2022 09:52:43 +0200 Subject: [PATCH] Update tests --- demo/app/tests/internal/sensor-callback-manager.spec.ts | 6 +++--- .../heart-rate/record-messaging-service.android.spec.ts | 4 ++-- .../location/record-messaging-service.android.spec.ts | 4 ++-- demo/app/tests/internal/sensors/triaxial/index.spec.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/demo/app/tests/internal/sensor-callback-manager.spec.ts b/demo/app/tests/internal/sensor-callback-manager.spec.ts index cc075c3..49cec35 100644 --- a/demo/app/tests/internal/sensor-callback-manager.spec.ts +++ b/demo/app/tests/internal/sensor-callback-manager.spec.ts @@ -10,15 +10,15 @@ describe("Sensor callback manager", () => { const sensorRecordA1: SensorRecord = { deviceId: "test", - timestamp: new Date() + timestamp: Date.now() }; const sensorRecordA2: SensorRecord = { deviceId: "test", - timestamp: new Date() + timestamp: Date.now() }; const sensorRecordB1: SensorRecord = { deviceId: "test", - timestamp: new Date() + timestamp: Date.now() }; const noNotificationTimeout = 100; diff --git a/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts b/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts index d49daa3..2fec5d5 100644 --- a/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts +++ b/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts @@ -37,7 +37,7 @@ describe("Heart rate record messaging service", () => { function getFakeHeartRateData() { return { - timestamp: new Date(), + timestamp: Date.now(), value: Math.floor(Math.random() * 100), }; } @@ -51,7 +51,7 @@ function buildFakeEncodedMessage(expectedRecords: HeartRateSensorRecord[]) { buff.putInt(expectedRecords.length); expectedRecords.forEach((record) => { buff.putInt(record.value); - buff.putLong(record.timestamp.getTime()); + buff.putLong(record.timestamp); }) return bytes; diff --git a/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts b/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts index af6f2c0..27a93ab 100644 --- a/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts +++ b/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts @@ -39,7 +39,7 @@ describe("Location record messaging service", () => { function getFakeLocationData() { return { - timestamp: new Date(), + timestamp: Date.now(), latitude: 39.9939752904, longitude: -0.0741332084749, altitude: 20, @@ -57,7 +57,7 @@ function buildFakeEncodedMessage(expectedRecords: LocationSensorRecord[]) { buff.putDouble(record.latitude); buff.putDouble(record.longitude); buff.putDouble(record.altitude); - buff.putLong(record.timestamp.getTime()); + buff.putLong(record.timestamp); }) return bytes; diff --git a/demo/app/tests/internal/sensors/triaxial/index.spec.ts b/demo/app/tests/internal/sensors/triaxial/index.spec.ts index 49c3e25..b04efae 100644 --- a/demo/app/tests/internal/sensors/triaxial/index.spec.ts +++ b/demo/app/tests/internal/sensors/triaxial/index.spec.ts @@ -2,7 +2,7 @@ import { TriAxialSensorRecord } from "nativescript-wearos-sensors/internal/senso export function getFakeTriAxialData() { return { - timestamp: new Date(), + timestamp: Date.now(), x: Math.random(), y: Math.random(), z: Math.random(), @@ -20,7 +20,7 @@ export function buildFakeEncodedMessage(expectedRecords: TriAxialSensorRecord[]) buff.putFloat(record.x); buff.putFloat(record.y); buff.putFloat(record.z); - buff.putLong(record.timestamp.getTime()); + buff.putLong(record.timestamp); }) return bytes;