Files
Desktop/ts/test-node/processSent_test.node.ts
Fedor Indutny c4ee32e9ee Use protopiler for protocol buffers
Co-authored-by: Jamie Kyle <jamie@signal.org>
2026-03-10 15:31:29 -07:00

59 lines
1.6 KiB
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import lodash from 'lodash';
import { generateAci } from '../types/ServiceId.std.js';
import { signalservice as Proto } from '../protobuf/compiled.std.js';
import { processSent } from '../textsecure/processSyncMessage.node.js';
const { omit } = lodash;
describe('processSent', () => {
const destinationServiceId = generateAci();
it('should normalize UUIDs in sent', () => {
const input = Proto.SyncMessage.Sent.decode(
Proto.SyncMessage.Sent.encode({
destinationServiceId: destinationServiceId.toUpperCase(),
destinationServiceIdBinary: null,
unidentifiedStatus: [
{
destinationServiceId: destinationServiceId.toUpperCase(),
unidentified: null,
destinationServiceIdBinary: null,
destinationPniIdentityKey: null,
},
],
destinationE164: null,
timestamp: null,
message: null,
expirationStartTimestamp: null,
isRecipientUpdate: null,
storyMessage: null,
storyMessageRecipients: null,
editMessage: null,
})
);
const out = processSent(input);
assert.deepStrictEqual(out, {
...omit(input, 'destinationServiceIdBinary', '$unknown'),
destinationServiceId,
unidentifiedStatus: [
{
$unknown: [],
destinationPniIdentityKey: undefined,
destinationServiceId,
unidentified: false,
},
],
storyMessageRecipients: [],
} as unknown);
});
});