Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Apr 2, 2024
1 parent 9762ade commit 4e142e8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/lib/test_contributions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 4e142e8

Please sign in to comment.