mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-18 07:36:00 +01:00
Use protopiler for protocol buffers
Co-authored-by: Jamie Kyle <jamie@signal.org>
This commit is contained in:
58
ts/test-node/processSent_test.node.ts
Normal file
58
ts/test-node/processSent_test.node.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user