Skip to content

Commit

Permalink
add repeated enums
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan-at-work committed Feb 22, 2020
1 parent 7907fab commit 4ff8162
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 142 deletions.
4 changes: 3 additions & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func TestTrafficJam(t *testing.T) {
"operationName": "q",
"variables": {
"req": {
"color": "GREEN"
"color": "GREEN",
"trafficLights": ["YELLOW", "RED"]
}
},
"query": "query q($req: TrafficJamReq) {\n trafficJam(req: $req) {\n next }\n}\n"
Expand All @@ -52,6 +53,7 @@ func TestTrafficJam(t *testing.T) {
h.ServeHTTP(w, req)

require.Equal(t, e2e.TrafficLight_GREEN, s.trafficJamReq.GetColor(), "Expected GraphQL request to populate Twirp Object")
require.Equal(t, []e2e.TrafficLight{e2e.TrafficLight_YELLOW, e2e.TrafficLight_RED}, s.trafficJamReq.GetTrafficLights(), "Expected repeated enums to be equal")

expected := `{"data":{"trafficJam":{"next":"YELLOW"}}}`

Expand Down
105 changes: 57 additions & 48 deletions e2e/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion e2e/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ service Service {
rpc Bread(BreadReq) returns (BreadResp);
rpc ChangeMe(ChangeMeReq) returns (ChangeMeResp) {
option (twirpql.options.rpc) = {
mutation: true;
mutation: true
};
};
}
Expand All @@ -28,6 +28,7 @@ message HelloResp {

message TrafficJamReq {
TrafficLight color = 1;
repeated TrafficLight trafficLights = 2;
}

enum TrafficLight {
Expand Down
Loading

0 comments on commit 4ff8162

Please sign in to comment.