mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
test(medications): strip line comments first in the intake tracking guard
The guard stripped block comments before line comments, so a '/*' inside a line comment opened a block that swallowed the code after it. The delta feed's intake read sat behind such a comment and was never seen. The shared stripper handles that order; with it the feed shows up, and it is listed: it mirrors recorded rows and computes no rate.
This commit is contained in:
1 parent
29620ffa49
commit
1b5e586a06
1 file changed
+3
-7
@@ -30,7 +30,7 @@ import { describe, it, expect } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { walkSourceFiles } from "./helpers/source-files";
|
||||
import { stripComments, walkSourceFiles } from "./helpers/source-files";
|
||||
|
||||
const SRC = join(process.cwd(), "src");
|
||||
|
||||
@@ -63,6 +63,8 @@ const INTAKE_MAY_SEE_EVERY_ROW: Record<string, string> = {
|
||||
"app/api/export/route.ts": "export of the recorded history",
|
||||
"lib/export/medications-backup.ts": "backup of the recorded history",
|
||||
"app/api/sync/state/route.ts": "sync watermarks, no rate",
|
||||
"app/api/sync/changes/route.ts":
|
||||
"delta feed mirroring the recorded rows to a paired client, no rate",
|
||||
"lib/jobs/measurement-tombstone-cleanup.ts": "tombstone purge",
|
||||
"lib/ai/coach/tools/availability.ts":
|
||||
"whether any intake history exists, and its date range",
|
||||
@@ -141,12 +143,6 @@ function sourceFiles(): string[] {
|
||||
}
|
||||
|
||||
/** Drop line and block comments so a mention in prose never counts. */
|
||||
function stripComments(source: string): string {
|
||||
return source
|
||||
.replace(/\/\*[\s\S]*?\*\//g, "")
|
||||
.replace(/(^|[^:])\/\/.*$/gm, "$1");
|
||||
}
|
||||
|
||||
function code(rel: string): string {
|
||||
return stripComments(readFileSync(join(SRC, rel), "utf8"));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user