Skip to content

Commit 1657172

Browse files
committed
Adjust bad inputs for server action test
1 parent c985757 commit 1657172

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

test/e2e/app-dir/actions/app-action.test.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,19 @@ describe('app-dir action handling', () => {
7878

7979
await browser.elementByCss('#submit').click()
8080

81-
const logs = await browser.log()
82-
expect(
83-
logs.some((log) =>
84-
log.message.includes(
85-
'Only plain objects, and a few built-ins, can be passed to Server Actions. Classes or null prototypes are not supported.'
86-
)
81+
await retry(async () => {
82+
const logs = await browser.log()
83+
84+
expect(logs).toMatchObject(
85+
expect.arrayContaining([
86+
expect.objectContaining({
87+
message: expect.stringContaining(
88+
'Cannot access value on the server.'
89+
),
90+
}),
91+
])
8792
)
88-
).toBe(true)
93+
})
8994
})
9095

9196
it('should propagate errors from a `text/plain` response to an error boundary', async () => {
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use server'
22

3-
export async function action() {
3+
export async function action(instance) {
4+
// Not allowed to access, as it's just a temporary reference.
5+
console.log(instance.value)
46
return 'action result'
57
}

test/e2e/app-dir/actions/app/error-handling/page.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ export default function Page() {
3434
)
3535
}
3636

37-
class Foo {}
37+
class Foo {
38+
value = 42
39+
}

0 commit comments

Comments
 (0)