mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 15:02:04 +00:00
Tighten the transport so device data lands on the right day and in the right slot. - Cumulative daily totals (steps, distance, energy, floors) now key their measuredAt and stats:<tag>:<day> external id off the interval's civil start date anchored at UTC-midday, not the physical instant. Keying off the physical instant put a positive-UTC-offset user's day one calendar day early and split the same local day across the Google, Apple, and Fitbit sources so neither won the per-day source pick. - Thread the user's timezone through the sleep, workout, and interval parses so an offset-less wall-clock timestamp resolves in the user's zone rather than the process zone — the same fix the classic Fitbit sleep path already carries. - Drop skin temperature from the launch set. Google reports a signed nightly deviation from baseline, not an absolute reading, so mapping it into the absolute wrist-temperature slot stored a delta as a temperature and dropped every cold-night negative. It returns once a signed-delta model exists. - Remove the unused daily-rollup read path and field-map, and the experimental ECG and irregular-rhythm scopes that had no reader — the connect flow now requests exactly the four core scopes it uses.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
GOOGLE_HEALTH_CORE_SCOPES,
|
|
getGoogleHealthScopeString,
|
|
resolveGoogleHealthScopes,
|
|
} from "../client";
|
|
|
|
describe("Google Health scope resolver", () => {
|
|
it("ships exactly the four core Restricted read scopes", () => {
|
|
const scopes = resolveGoogleHealthScopes();
|
|
expect(scopes).toEqual([...GOOGLE_HEALTH_CORE_SCOPES]);
|
|
expect(scopes).toHaveLength(4);
|
|
// Every core scope is a Restricted read-only googlehealth scope.
|
|
for (const s of scopes) {
|
|
expect(s).toMatch(
|
|
/^https:\/\/www\.googleapis\.com\/auth\/googlehealth\..+\.readonly$/,
|
|
);
|
|
}
|
|
});
|
|
|
|
it("requests no ECG/IRN Restricted scope (no reader consumes them yet)", () => {
|
|
for (const s of resolveGoogleHealthScopes()) {
|
|
expect(s).not.toContain("googlehealth.ecg");
|
|
expect(s).not.toContain("googlehealth.irn");
|
|
}
|
|
});
|
|
|
|
it("joins the resolved scopes with a single space for the authorize request", () => {
|
|
expect(getGoogleHealthScopeString()).toBe(
|
|
GOOGLE_HEALTH_CORE_SCOPES.join(" "),
|
|
);
|
|
expect(getGoogleHealthScopeString().split(" ")).toHaveLength(4);
|
|
});
|
|
});
|