Skip to content

Commit

Permalink
update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
smmoosavi committed Apr 7, 2024
1 parent 9cf5005 commit be210c0
Show file tree
Hide file tree
Showing 40 changed files with 2,314 additions and 167 deletions.
89 changes: 83 additions & 6 deletions derive/tests/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ fn test_app() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Foo {
value: String!
}
type Query {
other: Foo!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -65,7 +77,19 @@ fn test_app_with_generic() {

let schema = App::<()>::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Foo {
value: String!
}
type Query {
other: Foo!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -94,7 +118,19 @@ fn test_app_with_lifetime() {
let schema = App::create_schema().finish().unwrap();

let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Foo {
value: String!
}
type Query {
other: Foo!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -138,7 +174,19 @@ fn test_app_with_generic_and_lifetime() {

let schema = App::<()>::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Foo {
value: String!
}
type Query {
other: Foo!
}
schema {
query: Query
}
"###);
}
#[test]
fn test_nested_app() {
Expand Down Expand Up @@ -167,7 +215,24 @@ fn test_nested_app() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Bar {
value: String!
}
type Foo {
value: String!
}
type Query {
foo: Foo!
bar: Bar!
}
schema {
query: Query
}
"###);
}

mod test_in_mod {
Expand Down Expand Up @@ -198,6 +263,18 @@ mod test_in_mod {
async fn test() {
let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Foo {
value: String!
}
type Query {
foo: Foo!
}
schema {
query: Query
}
"###);
}
}
68 changes: 63 additions & 5 deletions derive/tests/expand_object/args_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ fn test_schema() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Query {
foo: String!
withoutSelf: String!
withSelf: String!
withArg(name: String!): String!
withoutSelfWithArgs(name: String!): String!
unusedArg(name: String!): String!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -91,7 +104,21 @@ fn test_schema_with_ctx() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Query {
foo: String!
withoutUnderline: String!
withoutSelf: String!
withSelf: String!
renamed: String!
withArg(name: String!): String!
withCtxArg(ctx: String!): String!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -125,7 +152,17 @@ fn test_schema_rename_args() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Query {
foo: String!
withArg(THE_NAME: String!, foo: String!): String!
withFieldRename(the_name: String!, foo: String!): String!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -157,7 +194,17 @@ fn test_schema_with_arg_ref() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Query {
foo: String!
withoutStringRef(name: String!): String!
withStr(name: String!): String!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -192,7 +239,18 @@ fn test_schema_with_arg_option() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Query {
foo: String!
withoutOption(name: String!): String!
withOption(name: String): String!
withOptionRef(name: String): String!
}
schema {
query: Query
}
"###);
}

#[tokio::test]
Expand Down
103 changes: 97 additions & 6 deletions derive/tests/expand_object/expand_object_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,20 @@ fn test_schema() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Example {
field: String!
}
type Query {
foo: String!
theExample: Example!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -115,7 +128,21 @@ fn test_schema_with_rename() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Example {
field: String!
}
type Query {
foo: String!
the_example: Example!
other: Example!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -158,7 +185,20 @@ fn test_schema_with_skip() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Example {
field: String!
}
type Query {
foo: String!
theExample: Example!
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -201,7 +241,21 @@ fn test_schema_with_deprecation() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Example {
field: String!
}
type Query {
foo: String!
example: Example! @deprecated
old: Example! @deprecated(reason: "this is the old one")
}
schema {
query: Query
}
"###);
}

#[test]
Expand Down Expand Up @@ -238,7 +292,23 @@ fn test_schema_with_description() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Example {
field: String!
}
type Query {
foo: String!
"""
this is the example
"""
theExample: Example!
}
schema {
query: Query
}
"###);
}

#[tokio::test]
Expand Down Expand Up @@ -411,7 +481,28 @@ async fn test_auto_register() {

let schema = App::create_schema().finish().unwrap();
let sdl = schema.sdl();
insta::assert_snapshot!(normalize_schema(&sdl), @"");
insta::assert_snapshot!(normalize_schema(&sdl), @r###"
type Example {
field: String!
}
input ExampleInput {
field: String!
}
type Foo {
field: String!
}
type Query {
foo: String!
example(input: ExampleInput): Example!
}
schema {
query: Query
}
"###);

let query = r#"
query {
Expand Down
Loading

0 comments on commit be210c0

Please sign in to comment.