Skip to content

Instantly share code, notes, and snippets.

@noghartt
Created January 5, 2024 17:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noghartt/a2c6a8ac8501231994a57875c84e520f to your computer and use it in GitHub Desktop.
Save noghartt/a2c6a8ac8501231994a57875c84e520f to your computer and use it in GitHub Desktop.
fetchQuery relay toPromise
import { fetchQuery, graphql } from 'relay-runtine';
export const fetchVersion = async (environment) => {
const response = fetchQuery(
environment,
graphql`
query fetchVersionQuery {
version
}
`,
{}
).toPromise();
return await fetchVersion();
}
import { createMockEnvironment } from 'relay-test-utils';
import { fetchVersion } from '
it('should get the version from graphql query', async () => {
const environment = createMockEnvironment();
await fetchVersion(environment); // timeout here
});
@sibelius
Copy link

sibelius commented Jan 5, 2024

missing mock of the query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment