MCPcopy
hub / github.com/parse-community/parse-server / setupMergeFixture

Function setupMergeFixture

spec/ParseInstallation.spec.js:1598–1619  ·  view source on GitHub ↗

* Sets up the merge fixture: * Row A — { installationId: iid, deviceType: 'ios' } (no deviceToken) * Row B — { deviceToken: t, deviceType: 'ios', channels } (no installationId) * Then triggers the merge by POSTing { installationId: iid, deviceToken: t }.

(t, iid, bChannels = ['orphan-history'])

Source from the content-addressed store, hash-verified

1596 * Then triggers the merge by POSTing { installationId: iid, deviceToken: t }.
1597 */
1598 async function setupMergeFixture(t, iid, bChannels = ['orphan-history']) {
1599 // Row A: matched by installationId, no deviceToken yet.
1600 await rest.create(config, auth.master(config), '_Installation', {
1601 deviceType: 'ios',
1602 installationId: iid,
1603 });
1604 // Row B: deviceToken-only orphan. Insert via the storage adapter to bypass
1605 // the require-at-least-one-ID check (the orphan has only deviceToken).
1606 const objectId = 'orph' + Math.random().toString(36).substring(2, 12);
1607 await database.adapter.createObject(
1608 '_Installation',
1609 installationSchema,
1610 {
1611 objectId,
1612 deviceType: 'ios',
1613 deviceToken: t,
1614 channels: bChannels,
1615 },
1616 null
1617 );
1618 return objectId;
1619 }
1620
1621 it('default options merge: deviceToken-holder wins, idMatch destroyed', async () => {
1622 const t = randomUUID();

Callers 1

Calls 3

createMethod · 0.80
toStringMethod · 0.80
createObjectMethod · 0.65

Tested by

no test coverage detected