graphql-engine/v3/crates/lang-graphql/tests
Samir Talwar ca61619c06 Format everything with Prettier. (#530)
I found myself wanting to rewrite JSON files with `sed`. The problem is,
then I want to run a formatter over them afterwards, and this will
change the whole file, not just the area I touched.

I would like to propose the nuclear option in remedying this: format
everything now. This is a very large change that should make it easier
to keep files to a consistent format in the future.

I have chosen to use Prettier for this because (a) it has a useful
`--write` command and (b) it also does GraphQL, Markdown, YAML, etc.

I've elected to exclude two sets of files:

1. `crates/custom-connector/data/*.json`, because they are actually
multiple JSON objects, one per line, which Prettier cannot parse.
2. `crates/lang-graphql/tests/**/*.graphql`, because it contains invalid
GraphQL, and the parser is intended to work with strangely-formatted
GraphQL.

The main changes are standardizing whitespace, adding a newline at the
end of files, and putting JSON arrays on one line when they fit.

V3_GIT_ORIGIN_REV_ID: 92d4a535c34a3cc00721e8ddc6f17c5717e8ff76
2024-04-30 14:58:57 +00:00
..
query_testdata lang-graphql: limit recursion to avoid stack overflows 2024-03-27 23:03:27 +00:00
schema_testdata Move all crates into a folder (#355) 2024-03-19 18:07:14 +00:00
testdata Move all crates into a folder (#355) 2024-03-19 18:07:14 +00:00
LICENSE-MIT Move all crates into a folder (#355) 2024-03-19 18:07:14 +00:00
parser_test.rs Use references where possible instead of cloning. (#478) 2024-04-18 17:35:48 +00:00
README.md Format everything with Prettier. (#530) 2024-04-30 14:58:57 +00:00

  • testdata contains snapshot/golden test inputs and expectations for SDL parsing
  • query_testdata and schema_data were later added, but for executable documents and SDL respectively. Theses cases were copied from the apollo-rs project at 721e0753 and the license at lang-graphql/tests/LICENSE-MIT applies to these. Cases added subsequently are licensed under this project's top-level license.
  • some cases from the apollo lexer tests are copied with a 9xxx prefix
  • schema_data cases are currently unused (TODO if SDL parsing is important)

A few full parse() cases were also added from graphql-js tests although they were not numerous or very interesting. They are added starting at ok/1111_*

Test cases from fuzzing are added into the err/6xxx_ namespace. In these cases a test failure is a panic.

Some ok cases that are only valid for the 2021 spec were renamed to *.2021 and ignored.

TODO

  • the ok case output mostly has not been audited
  • We might port the old testdata cases to the framework taken from apollo since it is nicer.