Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: parity with prettier on github schema #955

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cynic-parser/tests/actual_schemas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ macro_rules! schema_tests {
insta::assert_snapshot!(parsed.to_sdl_pretty());
}

#[test]
fn roundtrip() {
let parsed = cynic_parser::parse_type_system_document(SCHEMA)
.map_err(|error| error.to_report(SCHEMA))
.unwrap();
let sdl = parsed.to_sdl();

assert_eq!(SCHEMA, sdl);
}

#[test]
fn double_roundtrip() {
let parsed = cynic_parser::parse_type_system_document(SCHEMA)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ schema {
subscription: SubscriptionRoot
}

"""
Directs the executor to query only when the field exists.
"""
directive @ifdef on FIELD

type Book {
Expand Down
4 changes: 3 additions & 1 deletion schemas/books.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ schema {
subscription: SubscriptionRoot
}

# Directs the executor to query only when the field exists.
"""
Directs the executor to query only when the field exists.
"""
directive @ifdef on FIELD

type Book {
Expand Down
Loading
Loading