Pierre
Pierre•2mo ago

Components (aggregate, etc.) with convex-test

There is no documentation of how to use components (aggregate, etc.) with convex-test. Only an error message saying that we should call t.registerComponent(). Anyone knows how to do that?
7 Replies
Convex Bot
Convex Bot•2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart•2mo ago
There are example tests in the repo, here's the example for testing components: https://github.com/get-convex/convex-test/blob/main/convex/components.test.ts
GitHub
convex-test/convex/components.test.ts at main · get-convex/convex-...
Testing harness for pure-JS Convex tests. Contribute to get-convex/convex-test development by creating an account on GitHub.
Pierre
PierreOP•2mo ago
This example use a custom component that is directly inside the project. But, if I want to use the Aggregate component, https://github.com/get-convex/aggregate, I cannot import the schema (schema.ts) as it was not exported in the package.json. The example should include a component like Aggregate ... or aggregate should export the schema @erquhart : do you have another example ? It's funny actually that no one has asked this question before. In my opinion, Convex is so great and stable that few people use convex-test (as we can see in the npmjs.com stats) 😄 So, thank you again the Convex Team for this great product !
erquhart
erquhart•2mo ago
Ah yep, that's for testing components directly. Checking on this
Pierre
PierreOP•2mo ago
@erquhart : I created an issue for that in https://github.com/get-convex/convex-test/issues/40
GitHub
No documentation for registerComponent · Issue #40 · get-convex...
There is no documentation of how to use components (aggregate, etc.) with convex-test. Only an error message saying that we should call t.registerComponent(). The example in https://github.com/get-...
erquhart
erquhart•2mo ago
Could have sworn I replied on this, my bad - yes, it does need to be documented (and improved), but it is possible: https://github.com/get-convex/memory/blob/main/example/convex/setup.test.ts#L7-L18
GitHub
memory/example/convex/setup.test.ts at main · get-convex/memory
Document search component to aid RAG. Contribute to get-convex/memory development by creating an account on GitHub.
Pierre
PierreOP•2mo ago
Thank you very much ! It worked !

Did you find this page helpful?