This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 322e55cf24bbefc3a4790d0e8a5c9dbd0bb8ec1b
Author: Karthikeya1500 <[email protected]>
AuthorDate: Thu Mar 26 01:40:14 2026 +0530

    Add eunit test coverage for invalid quickjs commands
---
 src/couch/test/eunit/couch_js_tests.erl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/couch/test/eunit/couch_js_tests.erl 
b/src/couch/test/eunit/couch_js_tests.erl
index 29b303ffb..c5ad53eaa 100644
--- a/src/couch/test/eunit/couch_js_tests.erl
+++ b/src/couch/test/eunit/couch_js_tests.erl
@@ -38,7 +38,8 @@ couch_js_test_() ->
                 ?TDEF(should_allow_js_string_mutations),
                 ?TDEF(should_bump_timing_and_call_stats),
                 ?TDEF(should_exit_on_internal_error, 60),
-                ?TDEF(should_use_bigint)
+                ?TDEF(should_use_bigint),
+                ?TDEF(should_handle_invalid_command)
             ])
         }
     }.
@@ -465,6 +466,11 @@ should_use_bigint(_) ->
             ?assertThrow({compilation_error, _}, prompt(Proc, [<<"add_fun">>, 
Src]))
     end.
 
+should_handle_invalid_command(_) ->
+    Proc = couch_query_servers:get_os_process(<<"javascript">>),
+    BadCmd = [<<"bad">>, <<"foo">>],
+    ?assertThrow({unknown_command, <<"unknown command 'bad'">>}, prompt(Proc, 
BadCmd)).
+
 sample_time(Stat) ->
     couch_stats:sample([couchdb, query_server, time, Stat]).
 

Reply via email to