From 7995887c93ba2d48d81ef3d78910b0b8db38a0e5 Mon Sep 17 00:00:00 2001 From: Santhi Prakash <38608178+santhiprakash@users.noreply.github.com> Date: Thu, 13 Aug 2026 16:03:27 +0530 Subject: [PATCH] Add tests for GraphQL enum/scalar/union descriptions (#19801) Co-authored-by: fisker --- .../enum/__snapshots__/format.test.js.snap | 31 +++++++++++++++++++ tests/format/graphql/enum/description.graphql | 8 +++++ .../scalar/__snapshots__/format.test.js.snap | 27 ++++++++++++++++ .../format/graphql/scalar/description.graphql | 8 +++++ .../__snapshots__/format.test.js.snap | 27 ++++++++++++++++ .../graphql/union-types/description.graphql | 8 +++++ 6 files changed, 109 insertions(+) create mode 100644 tests/format/graphql/enum/description.graphql create mode 100644 tests/format/graphql/scalar/description.graphql create mode 100644 tests/format/graphql/union-types/description.graphql diff --git a/tests/format/graphql/enum/__snapshots__/format.test.js.snap b/tests/format/graphql/enum/__snapshots__/format.test.js.snap index 9f634de37..2d0ec3692 100644 --- a/tests/format/graphql/enum/__snapshots__/format.test.js.snap +++ b/tests/format/graphql/enum/__snapshots__/format.test.js.snap @@ -1,5 +1,36 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`description.graphql format 1`] = ` +====================================options===================================== +parsers: ["graphql"] + printWidth: 80 (default) | +=====================================input====================================== +"sigleline description" +enum E1 { A } + +""" +multiline +description +""" +enum E2 { A } + +=====================================output===================================== +"sigleline description" +enum E1 { + A +} + +""" +multiline +description +""" +enum E2 { + A +} + +================================================================================ +`; + exports[`enum.graphql format 1`] = ` ====================================options===================================== parsers: ["graphql"] diff --git a/tests/format/graphql/enum/description.graphql b/tests/format/graphql/enum/description.graphql new file mode 100644 index 000000000..3d4e9e3f2 --- /dev/null +++ b/tests/format/graphql/enum/description.graphql @@ -0,0 +1,8 @@ +"sigleline description" +enum E1 { A } + +""" +multiline +description +""" +enum E2 { A } diff --git a/tests/format/graphql/scalar/__snapshots__/format.test.js.snap b/tests/format/graphql/scalar/__snapshots__/format.test.js.snap index 671c7ec85..8db86c917 100644 --- a/tests/format/graphql/scalar/__snapshots__/format.test.js.snap +++ b/tests/format/graphql/scalar/__snapshots__/format.test.js.snap @@ -1,5 +1,32 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`description.graphql format 1`] = ` +====================================options===================================== +parsers: ["graphql"] + printWidth: 80 (default) | +=====================================input====================================== +"sigleline description" +scalar S1 + +""" +multiline +description +""" +scalar S2 + +=====================================output===================================== +"sigleline description" +scalar S1 + +""" +multiline +description +""" +scalar S2 + +================================================================================ +`; + exports[`scalar.graphql format 1`] = ` ====================================options===================================== parsers: ["graphql"] diff --git a/tests/format/graphql/scalar/description.graphql b/tests/format/graphql/scalar/description.graphql new file mode 100644 index 000000000..dbd151e0b --- /dev/null +++ b/tests/format/graphql/scalar/description.graphql @@ -0,0 +1,8 @@ +"sigleline description" +scalar S1 + +""" +multiline +description +""" +scalar S2 diff --git a/tests/format/graphql/union-types/__snapshots__/format.test.js.snap b/tests/format/graphql/union-types/__snapshots__/format.test.js.snap index f39fe894e..e6c8aa2d5 100644 --- a/tests/format/graphql/union-types/__snapshots__/format.test.js.snap +++ b/tests/format/graphql/union-types/__snapshots__/format.test.js.snap @@ -1,5 +1,32 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`description.graphql format 1`] = ` +====================================options===================================== +parsers: ["graphql"] + printWidth: 80 (default) | +=====================================input====================================== +"sigleline description" +union U1 = A | B + +""" +multiline +description +""" +union U2 = A | B + +=====================================output===================================== +"sigleline description" +union U1 = A | B + +""" +multiline +description +""" +union U2 = A | B + +================================================================================ +`; + exports[`union_types.graphql format 1`] = ` ====================================options===================================== parsers: ["graphql"] diff --git a/tests/format/graphql/union-types/description.graphql b/tests/format/graphql/union-types/description.graphql new file mode 100644 index 000000000..5c102be7d --- /dev/null +++ b/tests/format/graphql/union-types/description.graphql @@ -0,0 +1,8 @@ +"sigleline description" +union U1 = A | B + +""" +multiline +description +""" +union U2 = A | B