SolidJSS
SolidJSโ€ข3y ago
binbin

testing createRouteAction$ using vitest

Hi all! How do I go about testing createServerAction$ in vitest? I'm basically writing
export function SomeComponent(props) {
  const [action, { Form }] = createServerAction$(async (formData: FormData) => {
    console.log('validationStuff');
    return true;
  });

  return (
      <Form>...</Form>
  );
}


but when writing a simple vitest(by calling a "fireEvent.click(formButton);", the console.log is not hit at all. Are there fetch events to resolve? Or am I confusing both a frontend/backend test at the same? Thanks!
Was this page helpful?