mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-18 07:36:00 +01:00
Make export test resilient to out-of-order handling
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -393,7 +393,7 @@ describe('backup/attachments', () => {
|
|||||||
key: attachment1.key,
|
key: attachment1.key,
|
||||||
size: attachment1.size,
|
size: attachment1.size,
|
||||||
};
|
};
|
||||||
|
let roundtrippedAttachment: AttachmentType | undefined;
|
||||||
await asymmetricRoundtripHarness(
|
await asymmetricRoundtripHarness(
|
||||||
[
|
[
|
||||||
composeMessage(1, {
|
composeMessage(1, {
|
||||||
@@ -408,19 +408,31 @@ describe('backup/attachments', () => {
|
|||||||
attachments: [expectedRoundtrippedFields(attachment1)],
|
attachments: [expectedRoundtrippedFields(attachment1)],
|
||||||
}),
|
}),
|
||||||
composeMessage(2, {
|
composeMessage(2, {
|
||||||
attachments: [
|
attachments: [expectedRoundtrippedFields(attachment2)],
|
||||||
expectedRoundtrippedFields({
|
|
||||||
...attachment2,
|
|
||||||
cdnKey: attachment1.cdnKey,
|
|
||||||
cdnNumber: attachment1.cdnNumber,
|
|
||||||
uploadTimestamp: attachment1.uploadTimestamp,
|
|
||||||
incrementalMac: attachment1.incrementalMac,
|
|
||||||
chunkSize: attachment1.chunkSize,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
{ backupLevel: BackupLevel.Paid }
|
{
|
||||||
|
backupLevel: BackupLevel.Paid,
|
||||||
|
comparator: (before, after) => {
|
||||||
|
assert.deepEqual(
|
||||||
|
omit(before, 'attachments'),
|
||||||
|
omit(after, 'attachments')
|
||||||
|
);
|
||||||
|
if (!roundtrippedAttachment) {
|
||||||
|
roundtrippedAttachment = after?.attachments?.[0];
|
||||||
|
} else {
|
||||||
|
assert.equal(
|
||||||
|
roundtrippedAttachment.cdnKey,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
after.attachments?.[0]!.cdnKey
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
strictAssert(
|
||||||
|
roundtrippedAttachment != null,
|
||||||
|
'attachment was roundtripped'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('roundtrips voice message attachments', async () => {
|
it('roundtrips voice message attachments', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user