Mirror: The spec-compliant minimum of client-side GraphQL.

fix: Fix typo causing complex string parsing to fail on subsequent runs (#31)

* Fix typo in complex string detection

Fix typo causing complex string detection not to trigger
correctly.

* Add changeset

* Add test

authored by kitten.sh and committed by GitHub a7e16e51 3de51473

Changed files
+23 -1
.changeset
src
+5
.changeset/two-days-nail.md
··· 1 + --- 2 + '@0no-co/graphql.web': patch 3 + --- 4 + 5 + Fix typo causing complex string parsing to fail on subsequent runs.
+17
src/__tests__/parser.test.ts
··· 73 73 }).toThrow(); 74 74 }); 75 75 76 + it('parses escaped characters', () => { 77 + let ast = parse(` 78 + { field(arg: "Has another \\\\x sequence.") } 79 + `); 80 + expect(ast).toHaveProperty( 81 + 'definitions.0.selectionSet.selections.0.arguments.0.value.value', 82 + 'Has another \\x sequence.' 83 + ); 84 + ast = parse(` 85 + { field(arg: "Has a \\\\x sequence.") } 86 + `); 87 + expect(ast).toHaveProperty( 88 + 'definitions.0.selectionSet.selections.0.arguments.0.value.value', 89 + 'Has a \\x sequence.' 90 + ); 91 + }); 92 + 76 93 it('parses multi-byte characters', () => { 77 94 // Note: \u0A0A could be naively interpreted as two line-feed chars. 78 95 const ast = parse(`
+1 -1
src/parser.ts
··· 105 105 [Prop in ValueGroup]: string | undefined; 106 106 }; 107 107 108 - const complexStringRe = /\\/g; 108 + const complexStringRe = /\\/; 109 109 110 110 function value(constant: true): ast.ConstValueNode; 111 111 function value(constant: boolean): ast.ValueNode;