@@ -25,11 +25,14 @@ use value::{
2525} ;
2626
2727use super :: assert_contains;
28- use crate :: test_helpers:: UdfTest ;
28+ use crate :: test_helpers:: {
29+ UdfTest ,
30+ UdfTestType ,
31+ } ;
2932
3033#[ convex_macro:: test_runtime]
3134async fn test_not_found ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
32- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
35+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
3336 let err = t
3437 . query_js_error_no_validation ( "nonexistent" , assert_obj ! ( ) )
3538 . await ?;
@@ -57,7 +60,7 @@ async fn test_not_found(rt: TestRuntime) -> anyhow::Result<()> {
5760
5861#[ convex_macro:: test_runtime]
5962async fn test_bad_arguments_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
60- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
63+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
6164 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. query( "userError:badArgumentsError" , assert_obj!( ) ) . await ) ;
6265 assert ! ( s. contains( "Invalid argument `id` for `db.get`" ) , "{s}" ) ;
6366 Ok ( ( ) )
@@ -66,7 +69,7 @@ async fn test_bad_arguments_error(rt: TestRuntime) -> anyhow::Result<()> {
6669
6770#[ convex_macro:: test_runtime]
6871async fn test_bad_id_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
69- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
72+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
7073 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. query( "userError:badIdError" , assert_obj!( ) ) . await ) ;
7174 // A system UDF (listById) relies on this error message being invariant.
7275 assert ! ( s. contains( "Unable to decode ID" ) , "{s}" ) ;
@@ -76,7 +79,7 @@ async fn test_bad_id_error(rt: TestRuntime) -> anyhow::Result<()> {
7679
7780#[ convex_macro:: test_runtime]
7881async fn test_insertion_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
79- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
82+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
8083 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:insertError" , assert_obj!( ) ) . await ) ;
8184 assert ! (
8285 s. contains( "System tables (prefixed with `_`) are read-only." ) ,
@@ -90,7 +93,7 @@ async fn test_insertion_error(rt: TestRuntime) -> anyhow::Result<()> {
9093// specifically. Ensure that the error is catchable in JavaScript.
9194#[ convex_macro:: test_runtime]
9295async fn test_insert_error_with_bigint ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
93- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
96+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
9497 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:insertErrorWithBigint" , assert_obj!( ) ) . await ) ;
9598 assert ! (
9699 s. contains( "undefined is not a valid Convex value (present at path .bad" ) ,
@@ -102,7 +105,7 @@ async fn test_insert_error_with_bigint(rt: TestRuntime) -> anyhow::Result<()> {
102105
103106#[ convex_macro:: test_runtime]
104107async fn test_patch_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
105- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
108+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
106109 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:patchError" , assert_obj!( ) ) . await ) ;
107110 assert ! ( s. contains( "Update on nonexistent document ID" ) , "{s}" ) ;
108111 Ok ( ( ) )
@@ -112,7 +115,7 @@ async fn test_patch_error(rt: TestRuntime) -> anyhow::Result<()> {
112115#[ convex_macro:: test_runtime]
113116async fn test_patch_value_not_an_object ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
114117 // TODO: Reenable isolate2 when we implement table filter.
115- UdfTest :: run_test_with_isolate ( rt, async move |t| {
118+ UdfTest :: run_test_with_isolate ( rt, async move |t : UdfTestType | {
116119 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:patchValueNotAnObject" , assert_obj!( ) ) . await ) ;
117120 assert ! (
118121 s. contains( "Invalid argument `value` for `db.patch`: Value must be an Object" ) ,
@@ -124,7 +127,7 @@ async fn test_patch_value_not_an_object(rt: TestRuntime) -> anyhow::Result<()> {
124127
125128#[ convex_macro:: test_runtime]
126129async fn test_replace_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
127- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
130+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
128131 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:replaceError" , assert_obj!( ) ) . await ) ;
129132 assert ! ( s. contains( "Replace on nonexistent document ID" ) , "{s}" ) ;
130133 Ok ( ( ) )
@@ -133,7 +136,7 @@ async fn test_replace_error(rt: TestRuntime) -> anyhow::Result<()> {
133136
134137#[ convex_macro:: test_runtime]
135138async fn test_delete_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
136- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
139+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
137140 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:deleteError" , assert_obj!( ) ) . await ) ;
138141 assert ! ( s. contains( "Delete on nonexistent document ID" ) , "{s}" ) ;
139142 Ok ( ( ) )
@@ -143,7 +146,7 @@ async fn test_delete_error(rt: TestRuntime) -> anyhow::Result<()> {
143146#[ convex_macro:: test_runtime]
144147async fn test_nonexistent_table ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
145148 // TODO: Reenable isolate2 when we implement table filter.
146- UdfTest :: run_test_with_isolate ( rt, async move |t| {
149+ UdfTest :: run_test_with_isolate ( rt, async move |t : UdfTestType | {
147150 t. create_index ( "boatVotes.by_boat" , "boat" ) . await ?;
148151 t. backfill_indexes ( ) . await ?;
149152 let mut tx = t. database . begin ( Identity :: system ( ) ) . await ?;
@@ -161,7 +164,7 @@ async fn test_nonexistent_table(rt: TestRuntime) -> anyhow::Result<()> {
161164
162165#[ convex_macro:: test_runtime]
163166async fn test_nonexistent_id ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
164- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
167+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
165168 let mut tx = t. database . begin ( Identity :: system ( ) ) . await ?;
166169 let table_number = 8000 . try_into ( ) ?;
167170 let table_name: TableName = "_my_system_table" . parse ( ) ?;
@@ -221,7 +224,7 @@ async fn test_nonexistent_id(rt: TestRuntime) -> anyhow::Result<()> {
221224#[ convex_macro:: test_runtime]
222225async fn test_private_system_table ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
223226 // TODO: Reenable isolate2 when we implement table filter.
224- UdfTest :: run_test_with_isolate ( rt, async move |t| {
227+ UdfTest :: run_test_with_isolate ( rt, async move |t : UdfTestType | {
225228 let mut tx = t. database . begin ( Identity :: system ( ) ) . await ?;
226229
227230 // backend state automatically created by with_model().
@@ -251,7 +254,7 @@ async fn test_private_system_table(rt: TestRuntime) -> anyhow::Result<()> {
251254
252255#[ convex_macro:: test_runtime]
253256async fn test_unhandled_promise_rejection ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
254- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
257+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
255258 // Check that an unhandled promise rejection fails the UDF.
256259 let e = t
257260 . mutation_js_error ( "userError:unhandledRejection" , assert_obj ! ( ) )
@@ -264,7 +267,7 @@ async fn test_unhandled_promise_rejection(rt: TestRuntime) -> anyhow::Result<()>
264267
265268#[ convex_macro:: test_runtime]
266269async fn test_catching_async_exception_thrown_before_await ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
267- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
270+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
268271 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:asyncExceptionBeforeAwait" , assert_obj!( ) ) . await ) ;
269272 assert ! ( s. contains( "This is a custom exception" ) , "{s}" ) ;
270273 Ok ( ( ) )
@@ -273,7 +276,7 @@ async fn test_catching_async_exception_thrown_before_await(rt: TestRuntime) -> a
273276
274277#[ convex_macro:: test_runtime]
275278async fn test_catching_async_exception_thrown_after_await ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
276- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
279+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
277280 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:asyncExceptionAfterAwait" , assert_obj!( ) ) . await ) ;
278281 assert ! ( s. contains( "This is a custom exception" ) , "{s}" ) ;
279282 Ok ( ( ) )
@@ -282,7 +285,7 @@ async fn test_catching_async_exception_thrown_after_await(rt: TestRuntime) -> an
282285
283286#[ convex_macro:: test_runtime]
284287async fn test_throw_string ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
285- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
288+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
286289 must_let ! ( let Ok ( ConvexValue :: String ( s) ) = t. mutation( "userError:throwString" , assert_obj!( ) ) . await ) ;
287290 assert ! ( s. contains( "string - a string" ) , "{s}" ) ;
288291 Ok ( ( ) )
@@ -291,7 +294,7 @@ async fn test_throw_string(rt: TestRuntime) -> anyhow::Result<()> {
291294
292295#[ convex_macro:: test_runtime]
293296async fn test_async_syscall_error ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
294- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
297+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
295298 let e = t
296299 . mutation_js_error ( "userError:syscallError" , assert_obj ! ( ) )
297300 . await ?;
@@ -308,7 +311,7 @@ async fn test_async_syscall_error(rt: TestRuntime) -> anyhow::Result<()> {
308311
309312#[ convex_macro:: test_runtime]
310313async fn test_insert_with_creation_time ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
311- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
314+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
312315 let e = t
313316 . mutation_js_error ( "adversarial:insertWithCreationTime" , assert_obj ! ( ) )
314317 . await ?;
@@ -320,7 +323,7 @@ async fn test_insert_with_creation_time(rt: TestRuntime) -> anyhow::Result<()> {
320323
321324#[ convex_macro:: test_runtime]
322325async fn test_insert_with_id ( rt : TestRuntime ) -> anyhow:: Result < ( ) > {
323- UdfTest :: run_test_with_isolate2 ( rt, async move |t| {
326+ UdfTest :: run_test_with_isolate2 ( rt, async move |t : UdfTestType | {
324327 let e = t
325328 . mutation_js_error ( "adversarial:insertWithId" , assert_obj ! ( ) )
326329 . await ?;
0 commit comments