Sha256: 6b81e2a6cc6d15326b73055cb8f61ef725d4722d0eb3a6c7e211d5fc1003d402
Contents?: true
Size: 1.31 KB
Versions: 12
Compression:
Stored size: 1.31 KB
Contents
require "spec_helper" describe GraphQL::Language::Generation do let(:document) { GraphQL::Language::Parser.parse(query_string) } let(:query_string) {%| query getStuff($someVar: Int = 1, $anotherVar: [String!]) @skip(if: false) { myField: someField(someArg: $someVar, ok: 1.4) @skip(if: $anotherVar) @thing(or: "Whatever") anotherField(someArg: [1, 2, 3]) { nestedField ... moreNestedFields @skip(if: true) } ... on OtherType @include(unless: false) { field(arg: [{key: "value", anotherKey: 0.9, anotherAnotherKey: WHATEVER}]) anotherField } ... { id } } fragment moreNestedFields on NestedType @or(something: "ok") { anotherNestedField } |} describe ".generate" do it "generates query string" do assert_equal query_string.gsub(/^ /, "").strip, document.to_query_string end describe "inputs" do let(:query_string) {%| query { field(int: 3, float: 4.7e-24, bool: false, string: "☀︎🏆\\n escaped \\" unicode ¶ /", enum: ENUM_NAME, array: [7, 8, 9], object: {a: [1, 2, 3], b: {c: "4"}}, unicode_bom: "\xef\xbb\xbfquery") } |} it "generate" do assert_equal query_string.gsub(/^ /, "").strip, document.to_query_string end end end end
Version data entries
12 entries across 12 versions & 1 rubygems