From 4e142e81976129f86345b019271da73356272bfa Mon Sep 17 00:00:00 2001 From: Guillaume Petiot Date: Tue, 2 Apr 2024 16:38:13 +0100 Subject: [PATCH] Add test --- test/lib/test_contributions.ml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/lib/test_contributions.ml b/test/lib/test_contributions.ml index 201151b..9b9540e 100644 --- a/test/lib/test_contributions.ml +++ b/test/lib/test_contributions.ml @@ -327,6 +327,35 @@ let activity_example ~user = let activity_example_json ~user = Yojson.Safe.from_string (activity_example ~user) +let error_example = + {| + { + "errors": [ + { + "path": [ + "query", + "viewer", + "contributionsCollection", + "to" + ], + "extensions": { + "code": "argumentLiteralsIncompatible", + "typeName": "Field", + "argumentName": "to" + }, + "locations": [ + { + "line": 4, + "column": 5 + } + ], + "message": "Error." + } + ] +} |} + +let error_example_json = Yojson.Safe.from_string error_example + let contributions_example1 ~user = let open Contributions in { @@ -493,6 +522,10 @@ let test_of_json = username = user |> or_viewer; activity = Contributions.Repo_map.empty; })); + (let user = User.User "gpetiot" in + make_test "errors" + ~period:("2024-02-27T12:05:04Z", "2024-03-13T11:09:56Z") + ~user error_example_json ~expected:(Fmt.error_msg "Error.")); ] let test_is_empty =