Skip to content

Commit

Permalink
Move normalizeRelayPayload into the RelayPublishQueue-test
Browse files Browse the repository at this point in the history
Reviewed By: voideanvalue

Differential Revision: D46167273

fbshipit-source-id: 8190f3c50b7aef0330f681ac284137aa38c3fff7
  • Loading branch information
captbaritone authored and facebook-github-bot committed May 25, 2023
1 parent 9942761 commit 43be585
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 50 deletions.
32 changes: 31 additions & 1 deletion packages/relay-runtime/store/__tests__/RelayPublishQueue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@

'use strict';

import type {PayloadData, PayloadError} from '../network/RelayNetworkTypes';
import type {NormalizationOptions} from './RelayResponseNormalizer';
import type {
NormalizationSelector,
RelayResponsePayload,
} from './RelayStoreTypes';

const {graphql} = require('../../query/GraphQLTag');
const getRelayHandleKey = require('../../util/getRelayHandleKey');
const defaultGetDataID = require('../defaultGetDataID');
const normalizeRelayPayload = require('../normalizeRelayPayload');
const {
createOperationDescriptor,
} = require('../RelayModernOperationDescriptor');
const RelayModernRecord = require('../RelayModernRecord');
const RelayModernStore = require('../RelayModernStore');
const RelayPublishQueue = require('../RelayPublishQueue');
const RelayRecordSource = require('../RelayRecordSource');
const RelayResponseNormalizer = require('../RelayResponseNormalizer');
const {
ID_KEY,
REF_KEY,
Expand Down Expand Up @@ -1967,3 +1974,26 @@ describe('RelayPublishQueue', () => {
});
});
});

function normalizeRelayPayload(
selector: NormalizationSelector,
payload: PayloadData,
errors: ?Array<PayloadError>,
options: NormalizationOptions,
): RelayResponsePayload {
const source = RelayRecordSource.create();
source.set(
selector.dataID,
RelayModernRecord.create(selector.dataID, ROOT_TYPE),
);
const relayPayload = RelayResponseNormalizer.normalize(
source,
selector,
payload,
options,
);
return {
...relayPayload,
errors,
};
}
49 changes: 0 additions & 49 deletions packages/relay-runtime/store/normalizeRelayPayload.js

This file was deleted.

0 comments on commit 43be585

Please sign in to comment.