This commit is contained in:
Bryan Bennett 2024-01-05 06:25:13 -05:00
parent 31cac9373c
commit 5e505b178b
No known key found for this signature in database
GPG key ID: EE149E4215408DE9
13 changed files with 486 additions and 165 deletions

View file

@ -0,0 +1,41 @@
open Lib.Watches;
let test_get_path_removes_prefix = () => {
let input = `Assoc([
("path", `String("aaaaaaaaaaabbbbb"))
]);
Alcotest.(check(string))("Prefix removed", "bbbbb", get_path(input))
};
let test_get_paths_from_doc = () => {
let input = `Assoc([
("path", `String("aaaaaaaaaaabbbbb")),
("inputs", `Assoc([
("foo", `Assoc([
("path", `String("aaaaaaaaaaaccccc")),
("inputs", `Assoc([
("bar", `Assoc([
("path", `String("aaaaaaaaaaaddddd")),
("inputs", `Assoc([]))
]))
]))
]))
]))
]);
Alcotest.(check(list(string)))("Gathers all inputs", ["bbbbb", "ccccc", "ddddd"], get_paths_from_doc(input, []))
};
let () =
Alcotest.(
run(
"Watches",
[("get_path",
[
test_case("Removes prefix", `Quick, test_get_path_removes_prefix),
]),
("get_paths_from_doc",
[
test_case("Collects all paths", `Quick, test_get_paths_from_doc),
])
]),
);