-
I'm building out a GraphQL API and writing tests, and of course I'm writing a lot of query strings for the tests. So I'm wondering if it makes sense to try to DRY up the tests by writing a helper that would directly parse the schema produced by Most example tests online, including on graphql-ruby.org, do define query strings explicitly in the tests, and although it is a lot of duplication, i wonder if that's maybe a wise thing to do, since parsing a (maybe changing) schema directly might hide breaking changes in the schema...? I haven't found a "best practice" yet. An intermediate alternative seems to be manually copying specific query strings into a fixture accessed by the test helpers, so there's a "single location of duplication", if not a "single source of truth", for the query strings. That seems to be the approach implied in Testing/Schema Structure on graphql-ruby.org, which refers to a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Closing this question with embarrassment, it was the result of fatigue, delirium and confusion. 😓 |
Beta Was this translation helpful? Give feedback.
Closing this question with embarrassment, it was the result of fatigue, delirium and confusion. 😓