#Testing Hooks & Jobs
8 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
Community-Help:
Tests are good 🙇
I would just test them as regular JavaScript functions / components
for example?
what example? It's just JavaScript functions
you test it as you would any other JavaScript function, mocking payload like usual
There is a bit of casting required for TS, but yeah it should be like testing any other JS
export type BeforeValidateFromT = FieldHook<
Redirect,
NonNullable<Redirect['to']>['url'],
Redirect['to']
>
...
expect(
beforeValidateFrom({ value: input1 } as BeforeValidateFromT['arguments']),
).toStrictEqual(output1)