mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-27 05:38:12 +00:00
Support voice memo backups
This commit is contained in:
@@ -13,10 +13,11 @@ import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||
import { SeenStatus } from '../../MessageSeenStatus';
|
||||
import { loadCallsHistory } from '../../services/callHistoryLoader';
|
||||
import { setupBasics, asymmetricRoundtripHarness } from './helpers';
|
||||
import { IMAGE_JPEG } from '../../types/MIME';
|
||||
import { AUDIO_MP3, IMAGE_JPEG } from '../../types/MIME';
|
||||
import type { MessageAttributesType } from '../../model-types';
|
||||
import type { AttachmentType } from '../../types/Attachment';
|
||||
import { isVoiceMessage, type AttachmentType } from '../../types/Attachment';
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { SignalService } from '../../protobuf';
|
||||
|
||||
const CONTACT_A = generateAci();
|
||||
|
||||
@@ -129,6 +130,33 @@ describe('backup/attachments', () => {
|
||||
BackupLevel.Media
|
||||
);
|
||||
});
|
||||
it('roundtrips voice message attachments', async () => {
|
||||
const attachment = composeAttachment(1);
|
||||
attachment.contentType = AUDIO_MP3;
|
||||
attachment.flags = SignalService.AttachmentPointer.Flags.VOICE_MESSAGE;
|
||||
|
||||
strictAssert(isVoiceMessage(attachment), 'it is a voice attachment');
|
||||
strictAssert(attachment.digest, 'digest exists');
|
||||
|
||||
await asymmetricRoundtripHarness(
|
||||
[
|
||||
composeMessage(1, {
|
||||
attachments: [attachment],
|
||||
}),
|
||||
],
|
||||
[
|
||||
composeMessage(1, {
|
||||
attachments: [
|
||||
{
|
||||
...omit(attachment, ['path', 'iv', 'uploadTimestamp']),
|
||||
backupLocator: { mediaName: attachment.digest },
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
BackupLevel.Media
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Preview attachments', () => {
|
||||
|
||||
Reference in New Issue
Block a user