@@ -8,36 +8,36 @@ test('enum arguments in nested input objects should be handled correctly', () =>
8
8
// This test reproduces the bug from issue #1351
9
9
// When enum arguments are used in nested input objects with $ prefix,
10
10
// they should be properly converted to GraphQL enum values, not strings
11
-
12
- const graffleQuery = {
13
- stringWithArgInputObjectEnum : {
14
- $ : {
15
- input : {
16
- $abcEnum : 'A'
17
- }
18
- }
19
- }
11
+
12
+ const graffleQuery = {
13
+ stringWithArgInputObjectEnum : {
14
+ $ : {
15
+ input : {
16
+ $abcEnum : 'A' ,
17
+ } ,
18
+ } ,
19
+ } ,
20
20
}
21
-
21
+
22
22
const documentNormalized = Select . Document . createDocumentNormalizedFromQuerySelection (
23
23
graffleQuery ,
24
24
undefined ,
25
25
)
26
-
26
+
27
27
const { document } = toGraphQLDocument ( documentNormalized , {
28
28
sddm : PossibleWithScalars . schemaMap ,
29
29
scalars : { } ,
30
30
operationVariables : false ,
31
31
} )
32
-
32
+
33
33
const printed = Grafaid . Document . print ( document )
34
-
34
+
35
35
// The enum value should be unquoted in the GraphQL query
36
36
// It should be: abcEnum: A
37
37
// Not: abcEnum: "A"
38
38
expect ( printed ) . toMatch ( / a b c E n u m : \s * A (? ! \s * " ) / )
39
39
expect ( printed ) . not . toMatch ( / a b c E n u m : \s * " A " / )
40
-
40
+
41
41
// Full snapshot for clarity
42
42
expect ( printed ) . toMatchInlineSnapshot ( `
43
43
"{
@@ -47,28 +47,28 @@ test('enum arguments in nested input objects should be handled correctly', () =>
47
47
} )
48
48
49
49
test ( 'enum arguments at top level should work correctly' , ( ) => {
50
- const graffleQuery = {
51
- stringWithArgEnum : {
52
- $ : {
53
- $ABCEnum : 'A'
54
- }
55
- }
50
+ const graffleQuery = {
51
+ stringWithArgEnum : {
52
+ $ : {
53
+ $ABCEnum : 'A' ,
54
+ } ,
55
+ } ,
56
56
}
57
-
57
+
58
58
const documentNormalized = Select . Document . createDocumentNormalizedFromQuerySelection (
59
59
graffleQuery ,
60
60
undefined ,
61
61
)
62
-
62
+
63
63
const { document } = toGraphQLDocument ( documentNormalized , {
64
64
sddm : PossibleWithScalars . schemaMap ,
65
65
scalars : { } ,
66
66
operationVariables : false ,
67
67
} )
68
-
68
+
69
69
const printed = Grafaid . Document . print ( document )
70
-
70
+
71
71
// This should already work correctly
72
72
expect ( printed ) . toMatch ( / A B C E n u m : \s * A (? ! \s * " ) / )
73
73
expect ( printed ) . not . toMatch ( / A B C E n u m : \s * " A " / )
74
- } )
74
+ } )
0 commit comments