mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-17 15:23:36 +01:00
Use protopiler for protocol buffers
Co-authored-by: Jamie Kyle <jamie@signal.org>
This commit is contained in:
@@ -5,30 +5,40 @@ import { assert } from 'chai';
|
||||
import { arePinnedConversationsEqual } from '../../util/arePinnedConversationsEqual.node.js';
|
||||
import { SignalService as Proto } from '../../protobuf/index.std.js';
|
||||
|
||||
import PinnedConversation = Proto.AccountRecord.IPinnedConversation;
|
||||
import PinnedConversation = Proto.AccountRecord.PinnedConversation.Params;
|
||||
|
||||
describe('arePinnedConversationsEqual', () => {
|
||||
it('is equal if both have same values at same indices', () => {
|
||||
const localValue = [
|
||||
{
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
e164: '+13055551234',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
serviceIdBinary: null,
|
||||
e164: '+13055551234',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
groupMasterKey: new Uint8Array(32),
|
||||
identifier: {
|
||||
groupMasterKey: new Uint8Array(32),
|
||||
},
|
||||
},
|
||||
];
|
||||
const remoteValue = [
|
||||
{
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
e164: '+13055551234',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
serviceIdBinary: null,
|
||||
e164: '+13055551234',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
groupMasterKey: new Uint8Array(32),
|
||||
identifier: {
|
||||
groupMasterKey: new Uint8Array(32),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -38,29 +48,41 @@ describe('arePinnedConversationsEqual', () => {
|
||||
it('is not equal if values are mixed', () => {
|
||||
const localValue = [
|
||||
{
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
e164: '+13055551234',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
serviceIdBinary: null,
|
||||
e164: '+13055551234',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
contact: {
|
||||
serviceId: 'f59a9fed-9e91-4bb4-a015-d49e58b47e25',
|
||||
e164: '+17865554321',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: 'f59a9fed-9e91-4bb4-a015-d49e58b47e25',
|
||||
serviceIdBinary: null,
|
||||
e164: '+17865554321',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const remoteValue = [
|
||||
{
|
||||
contact: {
|
||||
serviceId: 'f59a9fed-9e91-4bb4-a015-d49e58b47e25',
|
||||
e164: '+17865554321',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: 'f59a9fed-9e91-4bb4-a015-d49e58b47e25',
|
||||
serviceIdBinary: null,
|
||||
e164: '+17865554321',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
e164: '+13055551234',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
serviceIdBinary: null,
|
||||
e164: '+13055551234',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -71,9 +93,12 @@ describe('arePinnedConversationsEqual', () => {
|
||||
it('is not equal if lengths are not same', () => {
|
||||
const localValue = [
|
||||
{
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
e164: '+13055551234',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
serviceIdBinary: null,
|
||||
e164: '+13055551234',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -84,15 +109,20 @@ describe('arePinnedConversationsEqual', () => {
|
||||
it('is not equal if content does not match', () => {
|
||||
const localValue = [
|
||||
{
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
e164: '+13055551234',
|
||||
identifier: {
|
||||
contact: {
|
||||
serviceId: '72313cde-2784-4a6f-a92a-abbe23763a60',
|
||||
serviceIdBinary: null,
|
||||
e164: '+13055551234',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const remoteValue = [
|
||||
{
|
||||
groupMasterKey: new Uint8Array(32),
|
||||
identifier: {
|
||||
groupMasterKey: new Uint8Array(32),
|
||||
},
|
||||
},
|
||||
];
|
||||
assert.isFalse(arePinnedConversationsEqual(localValue, remoteValue));
|
||||
|
||||
Reference in New Issue
Block a user