Skip to content

Commit 322e55c

Browse files
Karthikeya1500nickva
authored andcommitted
Add eunit test coverage for invalid quickjs commands
1 parent caaf84a commit 322e55c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/couch/test/eunit/couch_js_tests.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ couch_js_test_() ->
3838
?TDEF(should_allow_js_string_mutations),
3939
?TDEF(should_bump_timing_and_call_stats),
4040
?TDEF(should_exit_on_internal_error, 60),
41-
?TDEF(should_use_bigint)
41+
?TDEF(should_use_bigint),
42+
?TDEF(should_handle_invalid_command)
4243
])
4344
}
4445
}.
@@ -465,6 +466,11 @@ should_use_bigint(_) ->
465466
?assertThrow({compilation_error, _}, prompt(Proc, [<<"add_fun">>, Src]))
466467
end.
467468

469+
should_handle_invalid_command(_) ->
470+
Proc = couch_query_servers:get_os_process(<<"javascript">>),
471+
BadCmd = [<<"bad">>, <<"foo">>],
472+
?assertThrow({unknown_command, <<"unknown command 'bad'">>}, prompt(Proc, BadCmd)).
473+
468474
sample_time(Stat) ->
469475
couch_stats:sample([couchdb, query_server, time, Stat]).
470476

0 commit comments

Comments
 (0)