test: add test coverage

This commit is contained in:
Zaiming (Stone) Shi 2023-01-17 20:13:01 +01:00
parent b793aad344
commit fc992f28bc
1 changed files with 7 additions and 0 deletions

View File

@ -465,3 +465,10 @@ converter_invalid_input_test() ->
?assertEqual(undefined, emqx_schema:convert_servers(undefined)), ?assertEqual(undefined, emqx_schema:convert_servers(undefined)),
%% 'foo: bar' is a valid HOCON value, but 'bar' is not a port number %% 'foo: bar' is a valid HOCON value, but 'bar' is not a port number
?assertThrow("bad_host_port", emqx_schema:convert_servers(#{foo => bar})). ?assertThrow("bad_host_port", emqx_schema:convert_servers(#{foo => bar})).
password_converter_test() ->
?assertEqual(undefined, emqx_schema:password_converter(undefined, #{})),
?assertEqual(<<"123">>, emqx_schema:password_converter(123, #{})),
?assertEqual(<<"123">>, emqx_schema:password_converter(<<"123">>, #{})),
?assertThrow("must_quote", emqx_schema:password_converter(foobar, #{})),
ok.