mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
test(sharing): carry the two domain lists through the account-access contract
The account-access integration contract compares whole entries, so the two lists the payload now publishes belong in its expected shapes. The managed-record leg posts the mood entry with the logged-at instant the create schema requires.
This commit is contained in:
1 parent
4b3e71570c
commit
386e92e6f9
2 files changed
+12
-1
No files matched your search
@@ -111,7 +111,12 @@ function jsonRequest(url: string, body: unknown): NextRequest {
|
||||
|
||||
async function postMood() {
|
||||
const { POST } = await import("@/app/api/mood-entries/route");
|
||||
return POST(jsonRequest("/api/mood-entries", { mood: "GUT" }));
|
||||
return POST(
|
||||
jsonRequest("/api/mood-entries", {
|
||||
mood: "GUT",
|
||||
moodLoggedAt: new Date().toISOString(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function postAllergy() {
|
||||
|
||||
@@ -81,6 +81,8 @@ interface AccountAccessEntry {
|
||||
recordKind: "shared" | "managed";
|
||||
sections: string[] | null;
|
||||
canWrite: boolean;
|
||||
writableDomains: string[];
|
||||
manageableDomains: string[];
|
||||
}
|
||||
|
||||
interface AccountAccessBlock {
|
||||
@@ -183,6 +185,8 @@ describe("accountAccess — what the payload publishes", () => {
|
||||
recordKind: "shared",
|
||||
sections: null,
|
||||
canWrite: false,
|
||||
writableDomains: [],
|
||||
manageableDomains: [],
|
||||
},
|
||||
]);
|
||||
expect(accountAccess.canSwitch).toBe(true);
|
||||
@@ -342,6 +346,8 @@ describe("accountAccess — the active record", () => {
|
||||
recordKind: "shared",
|
||||
sections: null,
|
||||
canWrite: false,
|
||||
writableDomains: [],
|
||||
manageableDomains: [],
|
||||
});
|
||||
// The active entry is one of the listed ones, by construction. A banner
|
||||
// that had to join the two could render unnamed when they disagreed.
|
||||
|
||||
Reference in new issue
Block a user