Skip to content

Commit

Permalink
fix(next-drupal)!: upgrade tests to new async request objects
Browse files Browse the repository at this point in the history
  • Loading branch information
yobottehg committed Dec 6, 2024
1 parent 87d38a5 commit 2f40d7e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/next-drupal/tests/draft/draft.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,14 @@ describe("enableDraftMode()", () => {

// Our mock draftMode().enable does not set a cookie, so we set one.
;(await cookies()).set(draftModeCookie)
const draftModeCookieFromStore = (await cookies()).get(
DRAFT_MODE_COOKIE_NAME
) as ResponseCookie
expect(draftModeCookieFromStore.sameSite).toBe("lax")
expect(draftModeCookieFromStore.secure).toBeFalsy()

expect((await cookies()).get(DRAFT_MODE_COOKIE_NAME).sameSite).toBe("lax")
expect((await cookies()).get(DRAFT_MODE_COOKIE_NAME).secure).toBeFalsy()

await enableDraftMode(request, drupal)

expect(draftModeCookieFromStore.sameSite).toBe("none")
expect(draftModeCookieFromStore.secure).toBe(true)
expect((await cookies()).get(DRAFT_MODE_COOKIE_NAME).sameSite).toBe("none")
expect((await cookies()).get(DRAFT_MODE_COOKIE_NAME).secure).toBe(true)
})

test("sets a draft data cookie", async () => {
Expand Down

0 comments on commit 2f40d7e

Please sign in to comment.