expect('fixtures/parser').toMatchGolden(text => { try { return prettyStringify(RelayParser.parse(RelayTestSchema, text)); } catch (e) { return 'ERROR:\n' + e; } });
function addLogs(error, response, status) { if (graphiQLPrinter) { transaction.addLog('GraphiQL', graphiQLPrinter(operation, variables)); } transaction.addLog('Cache Config', cacheConfig); transaction.addLog('Variables', prettyStringify(variables)); if (status) { transaction.addLog('Status', status); } if (error) { transaction.addLog('Error', error); } if (response) { transaction.addLog('Response', response); } }
.map(doc => prettyStringify(RelayCodeGenerator.generate(doc)))
expect('fixtures/relay-flow-parser').toMatchGolden(text => { return prettyStringify(RelayFlowParser.parse(text, RelayTestSchema)); });
return { kind: 'Literal', name: parent.name, value: node.value, type: parent.type ? parent.type.toString() : null, }; }, Argument(node, key, parent, ancestors): ?ConcreteArgument { invariant( ['Variable', 'Literal'].indexOf(node.value.kind) >= 0, 'RelayCodeGenerator: Complex argument values (Lists or ' + 'InputObjects with nested variables) are not supported, argument ' + '`%s` had value `%s`. Source: %s.', node.name, prettyStringify(node.value), getErrorMessage(ancestors[0]), ); return node.value.value !== null ? node.value : null; }, }, }; function isPlural(type: any): boolean { return getNullableType(type) instanceof GraphQLList; } function valuesOrUndefined<T>(array: ?Array<T>): ?Array<T> { return !array || array.length === 0 ? undefined : array; }
expect('fixtures/parser').toMatchGolden(text => prettyStringify(RelayParser.parse(RelayTestSchema, text)),
doc => RelayPrinter.print(doc) + '# Metadata:\n' + prettyStringify(doc.metadata),