Skip to content

Commit

Permalink
remove unnecessary getRequest calls
Browse files Browse the repository at this point in the history
Reviewed By: mofeiZ

Differential Revision: D35360133

fbshipit-source-id: f37c735de267278ab16ef9dffbfb364c165c4d73
  • Loading branch information
kassens authored and facebook-github-bot committed Apr 4, 2022
1 parent f9a5ce6 commit 9ec4e78
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 259 deletions.
14 changes: 7 additions & 7 deletions packages/react-relay/__tests__/ReactRelayTestMocker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const QueryRenderer = require('../ReactRelayQueryRenderer');
const ReactRelayTestMocker = require('../ReactRelayTestMocker');
const React = require('react');
const ReactTestRenderer = require('react-test-renderer');
const {getRequest, graphql} = require('relay-runtime');
const {graphql} = require('relay-runtime');
const RelayTestUtils = require('relay-test-utils-internal');

const ReactRelayTestMockerTestQuery = graphql`
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('ReactRelayTestMocker', () => {

it('updates properly via default values', () => {
const testQueryDefault = {
query: getRequest(ReactRelayTestMockerTestQuery),
query: ReactRelayTestMockerTestQuery,
payload: {data: payload},
};

Expand All @@ -103,7 +103,7 @@ describe('ReactRelayTestMocker', () => {
const nestedQuery = ReactRelayTestMockerTestNestedQuery;

const nestedQueryDefault = {
query: getRequest(ReactRelayTestMockerTestNestedQuery),
query: ReactRelayTestMockerTestNestedQuery,
payload: {
data: {
viewer: {
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('ReactRelayTestMocker', () => {
expect(tree.toJSON()).toMatchSnapshot();

writer.networkWrite({
query: getRequest(ReactRelayTestMockerTestQuery),
query: ReactRelayTestMockerTestQuery,
payload: {data: payload},
});
jest.runAllTimers();
Expand All @@ -217,7 +217,7 @@ describe('ReactRelayTestMocker', () => {
tree = ReactTestRenderer.create(toRender);

writer.networkWrite({
query: getRequest(ReactRelayTestMockerTestQuery),
query: ReactRelayTestMockerTestQuery,
payload: {
data: null,
errors: [
Expand All @@ -242,7 +242,7 @@ describe('ReactRelayTestMocker', () => {
const q = ReactRelayTestMockerTestFragContainerTestQuery;

writer.dataWrite({
query: getRequest(ReactRelayTestMockerTestFragContainerTestQuery),
query: ReactRelayTestMockerTestFragContainerTestQuery,
payload: {data: payload},
variables,
});
Expand All @@ -267,7 +267,7 @@ describe('ReactRelayTestMocker', () => {
};

writer.dataWrite({
query: getRequest(ReactRelayTestMockerTestFragContainerTestQuery),
query: ReactRelayTestMockerTestFragContainerTestQuery,
payload: {data: newPayload},
variables,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import type {readUpdatableFragmentEXPERIMENTALTestRegularQuery} from './__generated__/readUpdatableFragmentEXPERIMENTALTestRegularQuery.graphql';

const RelayNetwork = require('../../network/RelayNetwork');
const {getRequest, graphql} = require('../../query/GraphQLTag');
const {graphql} = require('../../query/GraphQLTag');
const RelayModernEnvironment = require('../../store/RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('readUpdatableFragment', () => {
let rootRequest;

beforeEach(() => {
rootRequest = getRequest(regularQuery);
rootRequest = regularQuery;
operation = createOperationDescriptor(rootRequest, {if2: true, if3: false});
const source = RelayRecordSource.create();
const store = new RelayModernStore(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

'use strict';

import type {readUpdatableQueryEXPERIMENTALTest2UpdatableQuery} from './__generated__/readUpdatableQueryEXPERIMENTALTest2UpdatableQuery.graphql';
import type {readUpdatableQueryEXPERIMENTALTestRegularQuery} from './__generated__/readUpdatableQueryEXPERIMENTALTestRegularQuery.graphql';
import type {readUpdatableQueryEXPERIMENTALTestUpdatableQuery} from './__generated__/readUpdatableQueryEXPERIMENTALTestUpdatableQuery.graphql';

const RelayNetwork = require('../../network/RelayNetwork');
const {getRequest, graphql} = require('../../query/GraphQLTag');
const {graphql} = require('../../query/GraphQLTag');
const RelayModernEnvironment = require('../../store/RelayModernEnvironment');
const {
createOperationDescriptor,
Expand Down Expand Up @@ -137,7 +135,7 @@ describe('readUpdatableQuery', () => {
let rootRequest;

beforeEach(() => {
rootRequest = getRequest(regularQuery);
rootRequest = regularQuery;
operation = createOperationDescriptor(rootRequest, {});
const source = RelayRecordSource.create();
const store = new RelayModernStore(source);
Expand Down
Loading

0 comments on commit 9ec4e78

Please sign in to comment.