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:
@@ -182,27 +182,6 @@ describe('cleanDataForIpc', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('calls `toNumber` when available', () => {
|
||||
assert.deepEqual(
|
||||
cleanDataForIpc([
|
||||
{
|
||||
toNumber() {
|
||||
return 5;
|
||||
},
|
||||
},
|
||||
{
|
||||
toNumber() {
|
||||
return Symbol('bogus');
|
||||
},
|
||||
},
|
||||
]),
|
||||
{
|
||||
cleaned: [5, undefined],
|
||||
pathsChanged: ['root.1'],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('deeply cleans objects with a `null` prototype', () => {
|
||||
const value = Object.assign(Object.create(null), {
|
||||
'key 1': 'value',
|
||||
|
||||
@@ -13,6 +13,22 @@ import {
|
||||
getTableData,
|
||||
} from './helpers.node.js';
|
||||
|
||||
const EMPTY_ENVELOPE: Proto.Envelope.Params = {
|
||||
content: null,
|
||||
type: null,
|
||||
sourceServiceId: null,
|
||||
sourceDevice: null,
|
||||
destinationServiceId: null,
|
||||
timestamp: null,
|
||||
serverGuid: null,
|
||||
serverTimestamp: null,
|
||||
ephemeral: null,
|
||||
urgent: null,
|
||||
updatedPni: null,
|
||||
story: null,
|
||||
reportSpamToken: null,
|
||||
};
|
||||
|
||||
describe('SQL/updateToSchemaVersion1280', () => {
|
||||
let db: WritableDB;
|
||||
|
||||
@@ -62,10 +78,11 @@ describe('SQL/updateToSchemaVersion1280', () => {
|
||||
attempts: 5,
|
||||
envelope: Buffer.from(
|
||||
Proto.Envelope.encode({
|
||||
...EMPTY_ENVELOPE,
|
||||
destinationServiceId: THEIR_ACI,
|
||||
content: Buffer.from('encrypted1'),
|
||||
reportSpamToken: Buffer.from('token'),
|
||||
}).finish()
|
||||
})
|
||||
).toString('base64'),
|
||||
serverTimestamp: 6,
|
||||
serverGuid: 'guid1',
|
||||
@@ -81,9 +98,10 @@ describe('SQL/updateToSchemaVersion1280', () => {
|
||||
attempts: 5,
|
||||
envelope: Buffer.from(
|
||||
Proto.Envelope.encode({
|
||||
...EMPTY_ENVELOPE,
|
||||
type: 3,
|
||||
content: Buffer.from('encrypted2'),
|
||||
}).finish()
|
||||
})
|
||||
).toString('base64'),
|
||||
serverTimestamp: 7,
|
||||
serverGuid: 'guid2',
|
||||
@@ -99,8 +117,9 @@ describe('SQL/updateToSchemaVersion1280', () => {
|
||||
attempts: 6,
|
||||
envelope: Buffer.from(
|
||||
Proto.Envelope.encode({
|
||||
...EMPTY_ENVELOPE,
|
||||
content: Buffer.from('unused'),
|
||||
}).finish()
|
||||
})
|
||||
).toString('base64'),
|
||||
decrypted: 'CAFE',
|
||||
serverTimestamp: 8,
|
||||
|
||||
Reference in New Issue
Block a user