Skip to content

Commit

Permalink
Merge pull request #46 from baransu/fix/remove-bsField-from-query-output
Browse files Browse the repository at this point in the history
Rremove @bsfield directive from query output
  • Loading branch information
baransu authored Nov 23, 2019
2 parents 7520813 + b3b17f3 commit 73396de
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/base/graphql_printer.re
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ let is_internal_directive = d =>
switch (d.item.d_name.item) {
| "bsVariant"
| "bsRecord"
| "bsDecoder" => true
| "bsDecoder"
| "bsField" => true
| _ => false
};

Expand Down
55 changes: 27 additions & 28 deletions tests_bucklescript/__tests__/fragmentDefinition.re
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,38 @@ module MyQuery = [%graphql
|}
];

Jest.(
describe("Fragment definition", () => {
open Expect;
open! Expect.Operators;
open Jest;
open Expect;

test("Decodes the fragment", () =>
expect(
MyQuery.parse(
Js.Json.parseExn(
{|
describe("Fragment definition", () => {
test("Decodes the fragment", () =>
{|
{
"l1": {"nullableOfNullable": ["a", null, "b"]},
"l2": {"nullableOfNullable": ["a", null, "b"]}
}|},
),
),
)
== {
"l1": {
}|}
|> Js.Json.parseExn
|> MyQuery.parse
|> expect
|> toEqual({
"l1": {
"nullableOfNullable": Some([|Some("a"), None, Some("b")|]),
"nullableOfNonNullable": None,
},
"l2": {
"frag1": {
"nullableOfNullable": Some([|Some("a"), None, Some("b")|]),
"nullableOfNonNullable": None,
},
"l2": {
"frag1": {
"nullableOfNullable": Some([|Some("a"), None, Some("b")|]),
"nullableOfNonNullable": None,
},
"frag2": {
"nullableOfNullable": Some([|Some("a"), None, Some("b")|]),
"nullableOfNonNullable": None,
},
"frag2": {
"nullableOfNullable": Some([|Some("a"), None, Some("b")|]),
"nullableOfNonNullable": None,
},
}
);
})
);
},
})
);

test("Removes @bsField from query output", () =>
MyQuery.query |> Js.String.includes("@bsField") |> expect |> toBe(false)
);
});

0 comments on commit 73396de

Please sign in to comment.