Closed sshader closed 6 months ago
makes sense
On Tue, Mar 12, 2024 at 7:22 AM Sarah Shader @.***> wrote:
@.**** commented on this pull request.
In convex/testingFunctions.ts https://github.com/get-convex/convex-helpers/pull/80#discussion_r1521560238 :
+export const testingQuery = customQuery(query, {
- args: {},
- input: async (_ctx, _args) => {
- if (process.env.IS_TEST === undefined) {
- throw new Error(
- "Calling a test only function in an unexpected environment"
- );
- }
- return { ctx: {}, args: {} };
- }, +});
FWIW it'll vary from developer to developer whether they're using customCtx or verify so I kind of like the most explicit thing so there's no potential confusion around what to return.
Like if I was already using a customQuery handling a sessionId argument, I think it would be more obvious how to add this IS_TEST check to make a test only version of my query wrapper than if I used customCtx / verify
— Reply to this email directly, view it on GitHub https://github.com/get-convex/convex-helpers/pull/80#discussion_r1521560238, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQW63UC4C6SA35C7LPH3YX4FSNAVCNFSM6AAAAABEQ747N2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMZRGIYTOMZSGA . You are receiving this because your review was requested.Message ID: @.***>
Adds
ConvexTestingHelper
to theconvex-helpers
npm package + a simple example of running tests with a local backend.