-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add test for support for optional formData #123
base: main
Are you sure you want to change the base?
Conversation
5a87b62
to
a5eb057
Compare
@@ -23,3 +24,28 @@ test("POST /todo/form-add", async (t) => { | |||
|
|||
t.is(successfulRes.status, 200) | |||
}) | |||
|
|||
test("Valid formData object passes validation", (t) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to actually call and endpoint
|
||
axios.defaults.headers.common.Authorization = `Bearer auth_token` | ||
|
||
const bodyFormData = new URLSearchParams() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const bodyFormData = new URLSearchParams() | |
const bodyFormData = new FormData() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like FormData isn't supported. Seve created an issue to implement support for that: #127
|
||
const validFormData = { | ||
title: "test title", | ||
clear_sandbox_state: "clear_sandbox_state", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear_sandbox_state: "clear_sandbox_state", | |
completed: true, |
const formDataSchema = z | ||
.object({ | ||
title: z.string(), | ||
clear_sandbox_state: z.literal("clear_sandbox_state"), | ||
}) | ||
.safeParse(validFormData) | ||
|
||
t.true(formDataSchema.success) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const formDataSchema = z | |
.object({ | |
title: z.string(), | |
clear_sandbox_state: z.literal("clear_sandbox_state"), | |
}) | |
.safeParse(validFormData) | |
t.true(formDataSchema.success) |
No description provided.