mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
Say when a session has heart-rate figures but no profile behind them
The heart-rate card hid itself whenever the server resolved no curve. That is right for a session with no heart rate at all, but wrong for the common case it also covered: a ride logged from a chest strap through a provider that reports an average and a peak and nothing in between. The stats grid shows those two numbers, the card next to them renders nothing, and the page reads as if it has no heart-rate section rather than as if the shape behind the numbers is not on record. Three states now. A curve when there is one; a named absence when the session carries heart-rate figures without a profile; nothing at all when nothing was ever measured, since there is no absence to report there and an empty card would be a shell.
This commit is contained in:
1 parent
0c99c27bfc
commit
cea330bf70
8 files changed
+66
-14
No files matched your search
@@ -207,8 +207,27 @@ describe("<WorkoutDetailRoute>", () => {
|
||||
});
|
||||
|
||||
describe("<WorkoutDetailHrSection>", () => {
|
||||
it("returns null without an HR series", () => {
|
||||
expect(render(<WorkoutDetailHrSection workout={FIXTURE} />)).toBe("");
|
||||
it("names the absence when the session has heart-rate figures but no profile", () => {
|
||||
// The stats grid is showing an average and a peak for this session,
|
||||
// so the reader can see heart rate WAS recorded. Rendering nothing
|
||||
// here would read as "this page has no heart-rate section" rather
|
||||
// than as "the shape behind those numbers is not on record".
|
||||
const html = render(<WorkoutDetailHrSection workout={FIXTURE} />);
|
||||
expect(html).toContain('data-slot="workout-detail-hr-empty"');
|
||||
expect(html).toContain("No reading-by-reading heart-rate data");
|
||||
expect(html).not.toContain('data-slot="workout-hr-chart"');
|
||||
});
|
||||
|
||||
it("returns null when the session carries no heart rate at all", () => {
|
||||
// Nothing was measured, so there is no absence to report and an
|
||||
// empty card would be a shell.
|
||||
const noHr: WorkoutDetailPayload = {
|
||||
...FIXTURE,
|
||||
avgHr: null,
|
||||
maxHr: null,
|
||||
minHr: null,
|
||||
};
|
||||
expect(render(<WorkoutDetailHrSection workout={noHr} />)).toBe("");
|
||||
});
|
||||
|
||||
it("renders the card and a provenance chip for a pulse-window series", () => {
|
||||
|
||||
Reference in new issue
Block a user