@@ -68,6 +68,13 @@ export const testQuery = zQuery({
6868 } ) ,
6969} ) ;
7070
71+ export const testQueryNoArgs = zQuery ( {
72+ args : { } ,
73+ handler : async ( _ctx , args ) => {
74+ assertType < Record < string , never > > ( args ) ;
75+ } ,
76+ } ) ;
77+
7178/**
7279 * Test zCustomMutation with Zod schemas for args and return value
7380 */
@@ -254,6 +261,7 @@ export const generateUserId = mutation({
254261const testApi : ApiFromModules < {
255262 fns : {
256263 testQuery : typeof testQuery ;
264+ testQueryNoArgs : typeof testQueryNoArgs ;
257265 testMutation : typeof testMutation ;
258266 testAction : typeof testAction ;
259267 returnsNothing : typeof returnsNothing ;
@@ -287,6 +295,22 @@ describe("zCustomQuery, zCustomMutation, zCustomAction", () => {
287295 > ( ) ;
288296 } ) ;
289297
298+ describe ( "zCustomQuery with no args" , ( ) => {
299+ test ( "through t.query" , async ( ) => {
300+ const t = convexTest ( schema , modules ) ;
301+ const response = await t . query ( testApi . testQueryNoArgs ) ;
302+ expect ( response ) . toBeNull ( ) ;
303+ } ) ;
304+
305+ test ( "through t.run" , async ( ) => {
306+ const t = convexTest ( schema , modules ) ;
307+ const response = await t . run ( ( ctx ) =>
308+ ctx . runQuery ( testApi . testQueryNoArgs ) ,
309+ ) ;
310+ expect ( response ) . toBeNull ( ) ;
311+ } ) ;
312+ } ) ;
313+
290314 test ( "zCustomMutation" , async ( ) => {
291315 const t = convexTest ( schema , modules ) ;
292316 const response = await t . mutation ( testApi . testMutation , {
0 commit comments