Skip to content

Commit

Permalink
Add tests for mixed variables and literals
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Jul 12, 2017
1 parent c5c8f5a commit 96f4bf1
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,48 @@
it "is a valid query" do
assert_equal 0, errors.size
end

describe "mixed with invalid literals" do
let(:query_string) {
<<-GRAPHQL
query ($size: ImageSize!) {
imageUrl(sizes: [$size, 1, true])
}
GRAPHQL
}

it "is an invalid query" do
assert_equal 1, errors.size
end
end

describe "mixed with invalid variables" do
let(:query_string) {
<<-GRAPHQL
query ($size: ImageSize!, $wrongSize: Boolean!) {
imageUrl(sizes: [$size, $wrongSize])
}
GRAPHQL
}

it "is an invalid query" do
assert_equal 1, errors.size
end
end

describe "mixed with valid literals and invalid variables" do
let(:query_string) {
<<-GRAPHQL
query ($size: ImageSize!, $wrongSize: Boolean!) {
imageUrl(sizes: [$size, {height: 100} $wrongSize])
}
GRAPHQL
}

it "is an invalid query" do
assert_equal 1, errors.size
end
end
end
end
end

0 comments on commit 96f4bf1

Please sign in to comment.