This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-21
Channels
- # announcements (10)
- # aws (10)
- # babashka (23)
- # beginners (111)
- # biff (8)
- # calva (25)
- # clj-kondo (9)
- # cljsrn (4)
- # clojure (72)
- # clojure-belgium (6)
- # clojure-europe (50)
- # clojure-germany (2)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (1)
- # datahike (3)
- # emacs (10)
- # graalvm (19)
- # graphql (3)
- # juxt (7)
- # kaocha (9)
- # malli (23)
- # nbb (20)
- # pathom (17)
- # pedestal (6)
- # polylith (11)
- # portal (8)
- # remote-jobs (3)
- # shadow-cljs (18)
- # sql (3)
- # tools-deps (20)
Disregard please, something was messed up in my REPL. I even forked Lacinia to add a new test, but it's already passing. Pasting here if it's helpful to add:
(deftest external-fragments
(testing "when @skip is set on an external fragment"
(let [q "
fragment IdFrag on human {
id @skip(if: $skip)
}
query ($skip : Boolean!) {
human(id: \"1000\") {
name
... IdFrag
}
}
"]
(is (= {:data {:human {:name "Luke Skywalker"}}}
(execute compiled-schema q {:skip true} nil))
"should return name only")
(is (= {:data {:human {:name "Luke Skywalker"
:id "1000"}}}
(execute compiled-schema q {:skip false} nil))
"should return both fields")))
(testing "when @include is set on an external fragment"
(let [q "fragment IdFrag on human {
id @include(if: $include)
}
query ($include : Boolean!) {
human(id: \"1000\") {
name
... IdFrag
}
}"]
(is (= {:data {:human {:name "Luke Skywalker"}}}
(execute compiled-schema q {:include false} nil))
"should return name only")
(is (= {:data {:human {:name "Luke Skywalker"
:id "1000"}}}
(execute compiled-schema q {:include true} nil))
"should return both fields"))))