Group name spoofing warning

This commit is contained in:
Evan Hahn 2021-06-01 18:30:25 -05:00 committed by GitHub
parent 51b45ab275
commit 36c15fead4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 1312 additions and 215 deletions

View file

@ -0,0 +1,56 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { isConversationNameKnown } from '../../util/isConversationNameKnown';
describe('isConversationNameKnown', () => {
describe('for direct conversations', () => {
it('returns true if the conversation has a name', () => {
assert.isTrue(
isConversationNameKnown({
type: 'direct',
name: 'Jane Doe',
})
);
});
it('returns true if the conversation has a profile name', () => {
assert.isTrue(
isConversationNameKnown({
type: 'direct',
profileName: 'Jane Doe',
})
);
});
it('returns true if the conversation has an E164', () => {
assert.isTrue(
isConversationNameKnown({
type: 'direct',
e164: '+16505551234',
})
);
});
it('returns false if the conversation has none of the above', () => {
assert.isFalse(isConversationNameKnown({ type: 'direct' }));
});
});
describe('for group conversations', () => {
it('returns true if the conversation has a name', () => {
assert.isTrue(
isConversationNameKnown({
type: 'group',
name: 'Tahoe Trip',
})
);
});
it('returns true if the conversation lacks a name', () => {
assert.isFalse(isConversationNameKnown({ type: 'group' }));
});
});
});