Skip to content

Commit

Permalink
add kitchen test
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Dec 19, 2016
1 parent 96ced50 commit 985bb64
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 5 deletions.
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ URL: http://graphql.org
https://github.com/ropensci/graphql
BugReports: https://github.com/ropensci/graphql/issues
LinkingTo: Rcpp
Imports:
Rcpp (>= 0.12.0),
Imports:
Rcpp (>= 0.12.0),
jsonlite
LazyData: true
SystemRequirements: C++11
RoxygenNote: 5.0.1.9000
LazyData: NA
SystemRequirements: NA
RoxygenNote: 5.0.1
Suggests:
testthat
4 changes: 4 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(graphql)

test_check("graphql")
72 changes: 72 additions & 0 deletions tests/testthat/test-kitchen_sink.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
context("kitchen_sink")

test_that("kitchen sink parses", {

kitchen_txt <-
"
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
query queryName($foo: ComplexType, $site: Site = MOBILE) {
whoever123is: node(id: [123, 456]) {
id ,
... on User @defer {
field2 {
id ,
alias: field1(first:10, after:$foo,) @include(if: $foo) {
id,
...frag
}
}
}
... @skip(unless: $foo) {
id
}
... {
id
}
}
}
mutation likeStory {
like(story: 123) @defer {
story {
id
}
}
}
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) {
storyLikeSubscribe(input: $input) {
story {
likers {
count
}
likeSentence {
text
}
}
}
}
fragment frag on Friend {
foo(size: $size, bar: $b, obj: {key: \"value\"})
}
{
unnamed(truthy: true, falsey: false, nullish: null),
query
}
"

json_txt <- graphql2json(kitchen_txt)

result <- jsonlite::fromJSON(json_txt)

expect_true(is.list(result))

})

0 comments on commit 985bb64

Please sign in to comment.