You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking for the sample tests to test the Mutations. I tried the sample provided on the react-relay website, but the MockEnvironment is not working in my case. I am not able find out what is the exact issue.
TypeError: Cannot read property 'createOperationDescriptor' of undefined
at commitRelayModernMutation (node_modules/react-relay/node_modules/relay-runtime/lib/commitRelayModernMutation.js:33:57)
at enableHealthCheck (src/common/mutations/EnableHealthCheck.tsx:52:5)
at Object. (src/common/mutations/EnableHealthCheck.test.tsx:27:9)
Extract from commitRelayModernMutations: commitRelayModernMutation()
var _environment$unstable = environment.unstable_internal,
createOperationDescriptor = _environment$unstable.createOperationDescriptor,
getRequest = _environment$unstable.getRequest;
var mutation = getRequest(config.mutation);
Line No 1 => environment.unstable_internal is undefined in this case.
If I run same mutation with react-relay environment, this issue does not appear. This is only coming at the time of testing.
I am looking for the sample tests to test the Mutations. I tried the sample provided on the react-relay website, but the MockEnvironment is not working in my case. I am not able find out what is the exact issue.
https://relay.dev/docs/en/testing-relay-components#relaymockenvironment-api-overview
Errors I am facing:
TypeError: Cannot read property 'createOperationDescriptor' of undefined
at commitRelayModernMutation (node_modules/react-relay/node_modules/relay-runtime/lib/commitRelayModernMutation.js:33:57)
at enableHealthCheck (src/common/mutations/EnableHealthCheck.tsx:52:5)
at Object. (src/common/mutations/EnableHealthCheck.test.tsx:27:9)
Extract from commitRelayModernMutations: commitRelayModernMutation()
var _environment$unstable = environment.unstable_internal,
createOperationDescriptor = _environment$unstable.createOperationDescriptor,
getRequest = _environment$unstable.getRequest;
var mutation = getRequest(config.mutation);
Line No 1 => environment.unstable_internal is undefined in this case.
If I run same mutation with react-relay environment, this issue does not appear. This is only coming at the time of testing.
here is my code for Testing Mutation:
const {
createMockEnvironment,
MockPayloadGenerator,
} = require('relay-test-utils');
let environment: createMockEnvironment();
enableHealthCheck(environment, healthCheckInput, onCompleted, onError);
const operation = environment.mock.getMostRecentOperation();
Error is thrown when I call my mutation, which calls commitMutation.
Version
"relay-test-utils": "^7.0.0",
"react-relay": "4.0.0",
The text was updated successfully, but these errors were encountered: