forked from patricoferris/get-activity
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only test the request built and not the execution
- Loading branch information
Showing
9 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
val exec : | ||
val request : | ||
?variables:(string * Yojson.Safe.t) list -> | ||
token:string -> | ||
query:string -> | ||
unit -> | ||
(Yojson.Safe.t, [ `Msg of string ]) result | ||
Curly.Request.t | ||
|
||
val exec : Curly.Request.t -> (Yojson.Safe.t, [ `Msg of string ]) result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
open Get_activity | ||
|
||
let test_exec = | ||
let test_request = | ||
let make_test name ?variables ~token ~query ~expected () = | ||
let name = Printf.sprintf "exec: %s" name in | ||
let name = Printf.sprintf "request: %s" name in | ||
let test_fun () = | ||
let actual = Graphql.exec ?variables ~token ~query () in | ||
Alcotest.(check Alcotest_ext.(or_msg yojson)) name expected actual | ||
let actual = Graphql.request ?variables ~token ~query () in | ||
Alcotest.(check Alcotest_ext.request) name expected actual | ||
in | ||
(name, `Quick, test_fun) | ||
in | ||
[ | ||
make_test "no token" ~token:"" ~query:"" | ||
~expected:(Error (`Msg "GitHub returned errors: Bad credentials")) | ||
~expected: | ||
{ | ||
meth = `POST; | ||
url = "https://api.github.com/graphql"; | ||
headers = [ ("Authorization", "bearer ") ]; | ||
body = {|{"query":""}|}; | ||
} | ||
(); | ||
] | ||
|
||
let suite = ("Graphql", test_exec) | ||
let suite = ("Graphql", test_request) |