mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
test(auth): assert the cookie path returns the derived authMethod
The cookie arm of requireAuth now carries authMethod: "cookie" alongside the session payload, so the exact-shape assertion expects it.
This commit is contained in:
1 parent
6e46afc1fc
commit
c1bb997de7
2 files changed
+10
-11
No files matched your search
@@ -244,16 +244,14 @@ describe("POST /api/measurements/batch — syncTrigger diagnostic (iOS #66)", ()
|
||||
// sample row inserts. The per-row outcome must be identical regardless of
|
||||
// whether `syncTrigger` rides the request.
|
||||
const seedExisting = () =>
|
||||
vi
|
||||
.mocked(prisma.measurement.findMany)
|
||||
.mockResolvedValue([
|
||||
{
|
||||
id: "m1",
|
||||
type: "ACTIVITY_STEPS",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: STATS_ID,
|
||||
},
|
||||
] as never);
|
||||
vi.mocked(prisma.measurement.findMany).mockResolvedValue([
|
||||
{
|
||||
id: "m1",
|
||||
type: "ACTIVITY_STEPS",
|
||||
source: "APPLE_HEALTH",
|
||||
externalId: STATS_ID,
|
||||
},
|
||||
] as never);
|
||||
|
||||
const entries = [sampleEntry(SAMPLE_ID, 64), stepsEntry(STATS_ID, 5000)];
|
||||
|
||||
|
||||
@@ -390,7 +390,8 @@ describe("requireAuth — cookie path remains intact", () => {
|
||||
|
||||
const ctx = await requireAuth("medication:ingest");
|
||||
|
||||
expect(ctx).toEqual(cookieSession);
|
||||
// The cookie path carries the session payload plus the derived transport.
|
||||
expect(ctx).toEqual({ ...cookieSession, authMethod: "cookie" });
|
||||
// Cookie short-circuits before any token logic runs.
|
||||
expect(prisma.apiToken.findUnique).not.toHaveBeenCalled();
|
||||
expect(hashToken).not.toHaveBeenCalled();
|
||||
|
||||
Reference in new issue
Block a user