Skip to content

Commit

Permalink
fix issue with new enum representation
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed Jun 10, 2023
1 parent fe1b653 commit 89bccc2
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 20 deletions.
3 changes: 2 additions & 1 deletion packages/rescript-relay/__tests__/Test_connections.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Fragment = %relay(`
fragment TestConnections_user on User
@argumentDefinitions(
onlineStatuses: { type: "[OnlineStatus!]", defaultValue: [Idle] }
onlineStatuses: { type: "[OnlineStatus!]", defaultValue: [Idle, offline] }
count: { type: "Int", defaultValue: 2 }
cursor: { type: "String", defaultValue: "" }
beforeDate: { type: "Datetime!" }
Expand Down Expand Up @@ -48,6 +48,7 @@ module Fragment2 = %relay(`
# Different combinations of null default values, custom scalars, etc
objTest: {
datetime: $datetime,
enum: offline,
recursive: {
float: $flt,
datetime: $datetime2
Expand Down
2 changes: 1 addition & 1 deletion packages/rescript-relay/__tests__/Test_fragment-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("Fragment", () => {
node: {
id: "user-3",
firstName: "Third",
onlineStatus: "Offline",
onlineStatus: "offline",
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("Fragments with required", () => {
{
node: {
id: "user-3",
onlineStatus: "Offline",
onlineStatus: "offline",
},
},
{
Expand Down
5 changes: 3 additions & 2 deletions packages/rescript-relay/__tests__/Test_mutation.res
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ module Test = {
| Some(Online) => "online"
| Some(Idle) => "idle"
| Some(Offline) => "offline"
| Some(FutureAddedValue(_)) | None => "-"
| Some(FutureAddedValue(v)) => v
| None => "-"
}),
)}
<div> {React.string("Inline status: " ++ inlineStatus)} </div>
Expand Down Expand Up @@ -267,7 +268,7 @@ module Test = {
->RescriptRelay.RecordProxy.setValueString(
~name="onlineStatus",
~value=switch onlineStatus {
| Idle => "Offline"
| Idle => "offline"
| _ => "Online"
},
(),
Expand Down
4 changes: 2 additions & 2 deletions packages/rescript-relay/__tests__/Test_query-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ describe("Query", () => {
queryMock.mockQuery(
makeMockedQuery(
{
status: "Offline",
status: "offline",
},
[{ id: "user-2", firstName: "Second", onlineStatus: "Offline" }]
[{ id: "user-2", firstName: "Second", onlineStatus: "offline" }]
)
);

Expand Down
2 changes: 1 addition & 1 deletion packages/rescript-relay/__tests__/Test_refetching-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Fragment", () => {
variables: {
id: "user-1",
showOnlineStatus: true,
friendsOnlineStatuses: ["Online", "Offline"],
friendsOnlineStatuses: ["Online", "offline"],
},
data: {
node: {
Expand Down
2 changes: 1 addition & 1 deletion packages/rescript-relay/__tests__/Test_subscription.res
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module Test = {
->RescriptRelay.RecordProxy.setValueString(
~name="onlineStatus",
~value=switch onlineStatus {
| Idle => "Offline"
| Idle => "offline"
| _ => "Online"
},
(),
Expand Down
2 changes: 1 addition & 1 deletion packages/rescript-relay/__tests__/Test_union-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Unions", () => {
__typename: "User",
id: "user-2",
firstName: "Second",
onlineStatus: "Offline",
onlineStatus: "offline",
},
},
{
Expand Down

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

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

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

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

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

3 changes: 2 additions & 1 deletion packages/rescript-relay/__tests__/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ input SomeInput {
datetime: Datetime
recursive: SomeInput
private: Boolean
enum: OnlineStatus
}

interface Node {
Expand All @@ -50,7 +51,7 @@ Whether something is online or not.
enum OnlineStatus {
Online
Idle
Offline
offline
}

interface HasName {
Expand Down

0 comments on commit 89bccc2

Please sign in to comment.