Skip to main content
Glama
chainedScheduling.test.ts997 B
import { convexTest } from "convex-test"; import { expect, test, vi } from "vitest"; import { api } from "./_generated/api"; import schema from "./schema"; test("mutation scheduling action scheduling action", async () => { // Enable fake timers vi.useFakeTimers(); const t = convexTest(schema, modules); // Call a function that schedules a mutation or action await t.mutation(api.scheduler.mutationSchedulingActionSchedulingAction); // Wait for all scheduled functions, repeatedly // advancing time and waiting for currently in-progress // functions to finish await t.finishAllScheduledFunctions(vi.runAllTimers); // Assert the resulting state after all scheduled functions finished const createdTask = await t.run(async (ctx) => { return await ctx.db.query("tasks").first(); }); expect(createdTask).toMatchObject({ author: "AI" }); // Reset to normal `setTimeout` etc. implementation vi.useRealTimers(); }); const modules = import.meta.glob("./**/*.ts");

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/get-convex/convex-backend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server