Test more contact splitting scenarios
This commit is contained in:
parent
304287efef
commit
900b40381c
3 changed files with 93 additions and 81 deletions
|
@ -1515,7 +1515,7 @@ async function processRemoteRecords(
|
||||||
});
|
});
|
||||||
|
|
||||||
// Find remote contact records that:
|
// Find remote contact records that:
|
||||||
// - Have `remote.pni === remote.serviceUuid` and have `remote.serviceE164`
|
// - Have `remote.pni` and have `remote.serviceE164`
|
||||||
// - Match local contact that has `aci`.
|
// - Match local contact that has `aci`.
|
||||||
const splitPNIContacts = new Array<MergeableItemType>();
|
const splitPNIContacts = new Array<MergeableItemType>();
|
||||||
prunedStorageItems = prunedStorageItems.filter(item => {
|
prunedStorageItems = prunedStorageItems.filter(item => {
|
||||||
|
|
|
@ -229,7 +229,13 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
it('accepts storage service contact splitting', async () => {
|
for (const withPniContact of [false, true]) {
|
||||||
|
const testName =
|
||||||
|
'accepts storage service contact splitting ' +
|
||||||
|
`${withPniContact ? 'with PNI contact' : 'without PNI contact'}`;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-loop-func
|
||||||
|
it(testName, async () => {
|
||||||
const { phone } = bootstrap;
|
const { phone } = bootstrap;
|
||||||
|
|
||||||
debug(
|
debug(
|
||||||
|
@ -281,6 +287,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||||
unregisteredAtTimestamp: Long.fromNumber(bootstrap.getTimestamp()),
|
unregisteredAtTimestamp: Long.fromNumber(bootstrap.getTimestamp()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (withPniContact) {
|
||||||
state = state.addContact(
|
state = state.addContact(
|
||||||
pniContact,
|
pniContact,
|
||||||
{
|
{
|
||||||
|
@ -294,6 +301,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||||
},
|
},
|
||||||
ServiceIdKind.PNI
|
ServiceIdKind.PNI
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
state = state.pin(pniContact, ServiceIdKind.PNI);
|
state = state.pin(pniContact, ServiceIdKind.PNI);
|
||||||
|
|
||||||
|
@ -311,14 +319,18 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||||
debug('Verify that the message is in the ACI conversation');
|
debug('Verify that the message is in the ACI conversation');
|
||||||
{
|
{
|
||||||
// Should have both PNI and ACI messages
|
// Should have both PNI and ACI messages
|
||||||
await window.locator('.module-message__text >> "Hello merged"').waitFor();
|
await window
|
||||||
|
.locator('.module-message__text >> "Hello merged"')
|
||||||
|
.waitFor();
|
||||||
|
|
||||||
const messages = window.locator('.module-message__text');
|
const messages = window.locator('.module-message__text');
|
||||||
assert.strictEqual(await messages.count(), 1, 'message count');
|
assert.strictEqual(await messages.count(), 1, 'message count');
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('Open PNI conversation');
|
debug('Open PNI conversation');
|
||||||
await leftPane.locator(`[data-testid="${pniContact.device.pni}"]`).click();
|
await leftPane
|
||||||
|
.locator(`[data-testid="${pniContact.device.pni}"]`)
|
||||||
|
.click();
|
||||||
|
|
||||||
debug('Verify absence of messages in the PNI conversation');
|
debug('Verify absence of messages in the PNI conversation');
|
||||||
{
|
{
|
||||||
|
@ -326,6 +338,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||||
assert.strictEqual(await messages.count(), 0, 'message count');
|
assert.strictEqual(await messages.count(), 0, 'message count');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('splits contact when ACI becomes unregistered', async () => {
|
it('splits contact when ACI becomes unregistered', async () => {
|
||||||
const { phone, server } = bootstrap;
|
const { phone, server } = bootstrap;
|
||||||
|
|
|
@ -640,8 +640,7 @@ export type CapabilitiesType = {
|
||||||
pni: boolean;
|
pni: boolean;
|
||||||
};
|
};
|
||||||
export type CapabilitiesUploadType = {
|
export type CapabilitiesUploadType = {
|
||||||
// true in staging, false in production
|
pni: true;
|
||||||
pni: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type StickerPackManifestType = Uint8Array;
|
type StickerPackManifestType = Uint8Array;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue