Don't show name collisions for system contacts

This commit is contained in:
Evan Hahn 2021-06-02 12:24:22 -05:00 committed by GitHub
parent 84be8288e9
commit 6c6eed0b1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 121 additions and 17 deletions

View file

@ -0,0 +1,46 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { isInSystemContacts } from '../../util/isInSystemContacts';
describe('isInSystemContacts', () => {
it('returns true for direct conversations that have a `name` property', () => {
assert.isTrue(
isInSystemContacts({
type: 'direct',
name: 'Jane Doe',
})
);
assert.isTrue(
isInSystemContacts({
type: 'private',
name: 'Jane Doe',
})
);
});
it('returns true for direct conversations that have an empty string `name`', () => {
assert.isTrue(
isInSystemContacts({
type: 'direct',
name: '',
})
);
});
it('returns false for direct conversations that lack a `name` property', () => {
assert.isFalse(isInSystemContacts({ type: 'direct' }));
});
it('returns false for group conversations', () => {
assert.isFalse(isInSystemContacts({ type: 'group' }));
assert.isFalse(
isInSystemContacts({
type: 'group',
name: 'Tahoe Trip',
})
);
});
});