-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unskip middleware deploy test (#70264)
This whole test suite was disabled but only 2 tests rely on runtime logs, so this refactors the test to remove the runtime log dependency in favor of returning the output from the action and reading from the DOM.
- Loading branch information
Showing
4 changed files
with
36 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 4 additions & 10 deletions
14
test/e2e/app-dir/app-middleware/app/rsc-cookies/cookie-options/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
import { cookies } from 'next/headers' | ||
import Link from 'next/link' | ||
import { Form } from '../form' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<p id="total-cookies">Total Cookie Length: {cookies().size}</p> | ||
<Link href="/rsc-cookies-delete">To Delete Cookies Route</Link> | ||
|
||
<form | ||
<Form | ||
action={async () => { | ||
'use server' | ||
console.log( | ||
'[Cookie From Action]:', | ||
cookies().get('rsc-secure-cookie').value | ||
) | ||
return cookies().get('rsc-secure-cookie').value | ||
}} | ||
> | ||
<button type="submit" id="submit-server-action"> | ||
server action | ||
</button> | ||
</form> | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use client' | ||
|
||
import { useActionState } from 'react' | ||
|
||
export function Form({ action }) { | ||
const [state, formAction] = useActionState(action, null) | ||
|
||
return ( | ||
<form action={formAction}> | ||
<div id="action-result">Action Result: {state}</div> | ||
<button type="submit" id="submit-server-action"> | ||
server action | ||
</button> | ||
</form> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters