diff --git a/test/e2e/app-dir/app-routes/app-custom-routes.test.ts b/test/e2e/app-dir/app-routes/app-custom-routes.test.ts index 56b627dcb332c..3c8cbf119c139 100644 --- a/test/e2e/app-dir/app-routes/app-custom-routes.test.ts +++ b/test/e2e/app-dir/app-routes/app-custom-routes.test.ts @@ -423,6 +423,16 @@ createNextDescribe( }) }) + describe('cookies().has()', () => { + it('gets the correct values', async () => { + const res = await next.fetch(bathPath + '/hooks/cookies/has') + + expect(res.status).toEqual(200) + + expect(await res.json()).toEqual({ hasCookie: true }) + }) + }) + describe('redirect', () => { it('can respond correctly', async () => { const res = await next.fetch(bathPath + '/hooks/redirect', { diff --git a/test/e2e/app-dir/app-routes/app/hooks/cookies/has/route.ts b/test/e2e/app-dir/app-routes/app/hooks/cookies/has/route.ts new file mode 100644 index 0000000000000..adf2d68e13c38 --- /dev/null +++ b/test/e2e/app-dir/app-routes/app/hooks/cookies/has/route.ts @@ -0,0 +1,10 @@ +import { NextResponse } from 'next/server' +import { cookies } from 'next/headers' + +export async function GET() { + const c = cookies() + c.set('a', 'a') + const hasCookie = c.has('a') + + return NextResponse.json({ hasCookie }) // expect { hasCookie: true } +}