Remove GroupContext proto

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Josh Perez 2023-04-14 20:52:50 -04:00 committed by GitHub
parent 9bfbee464b
commit 68ae25f5cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 74 additions and 713 deletions

View file

@ -32,10 +32,6 @@ const PROCESSED_ATTACHMENT: ProcessedAttachment = {
size: 34,
};
const GROUP_ID = new Uint8Array([0x68, 0x65, 0x79]);
const DERIVED_GROUPV2_ID = '7qQUi8Wa6Jm3Rl+l63saATGeciEqokbHpP+lV3F5t9o=';
describe('processDataMessage', () => {
const check = (message: Proto.IDataMessage) =>
processDataMessage(
@ -85,59 +81,6 @@ describe('processDataMessage', () => {
);
});
it('should process group context UPDATE/QUIT message', () => {
const { UPDATE, QUIT } = Proto.GroupContext.Type;
for (const type of [UPDATE, QUIT]) {
const out = check({
body: 'should be deleted',
attachments: [UNPROCESSED_ATTACHMENT],
group: {
id: GROUP_ID,
name: 'Group',
avatar: UNPROCESSED_ATTACHMENT,
type,
membersE164: ['+1'],
},
});
assert.isUndefined(out.body);
assert.strictEqual(out.attachments.length, 0);
assert.deepStrictEqual(out.group, {
id: 'hey',
name: 'Group',
avatar: PROCESSED_ATTACHMENT,
type,
membersE164: ['+1'],
derivedGroupV2Id: DERIVED_GROUPV2_ID,
});
}
});
it('should process group context DELIVER message', () => {
const out = check({
body: 'should not be deleted',
attachments: [UNPROCESSED_ATTACHMENT],
group: {
id: GROUP_ID,
name: 'should be deleted',
membersE164: ['should be deleted'],
type: Proto.GroupContext.Type.DELIVER,
},
});
assert.strictEqual(out.body, 'should not be deleted');
assert.strictEqual(out.attachments.length, 1);
assert.deepStrictEqual(out.group, {
id: 'hey',
type: Proto.GroupContext.Type.DELIVER,
membersE164: [],
derivedGroupV2Id: DERIVED_GROUPV2_ID,
avatar: undefined,
name: undefined,
});
});
it('should process groupv2 context', () => {
const out = check({
groupV2: {
@ -312,15 +255,10 @@ describe('processDataMessage', () => {
const out = check({
flags: FLAGS.END_SESSION,
body: 'should be deleted',
group: {
id: GROUP_ID,
type: Proto.GroupContext.Type.DELIVER,
},
attachments: [UNPROCESSED_ATTACHMENT],
});
assert.isUndefined(out.body);
assert.isUndefined(out.group);
assert.deepStrictEqual(out.attachments, []);
});