Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
/// <reference types="vite/client" />
import type { TestConvex } from "convex-test";
import type { GenericSchema, SchemaDefinition } from "convex/server";
import { componentsGeneric } from "convex/server";
import type { ComponentApi } from "./component/_generated/component.js";
import schema from "./component/schema.js";
const modules = import.meta.glob("./component/**/*.ts");

/**
* Register the component with the test convex instance.
* @param t - The test convex instance, e.g. from calling `convexTest`.
* @param name - The name of the component, as registered in convex.config.ts.
* @returns a component api to test via ctx.runMutation or for thick client
* usage. Also provides types for convex-test's defineTestApp.
*/
export function register(
t: TestConvex<SchemaDefinition<GenericSchema, boolean>>,
name: string = "resend",
) {
t.registerComponent(name, schema, modules);
return componentsGeneric()[name] as unknown as ComponentApi;
}
export default { register, schema, modules };
Loading