Restore ability to message someone from embedded contact

This commit is contained in:
Scott Nonnenberg 2022-04-11 17:26:09 -07:00 committed by GitHub
parent f77175f6b3
commit 302604f67e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 311 additions and 236 deletions

View file

@ -14,6 +14,7 @@ import {
parseAndWriteAvatar,
} from '../../types/EmbeddedContact';
import { fakeAttachment } from '../../test-both/helpers/fakeAttachment';
import { UUID } from '../../types/UUID';
describe('Contact', () => {
const NUMBER = '+12025550099';
@ -113,7 +114,7 @@ describe('Contact', () => {
describe('embeddedContactSelector', () => {
const regionCode = '1';
const firstNumber = '+1202555000';
const isNumberOnSignal = false;
const uuid = undefined;
const getAbsoluteAttachmentPath = (path: string) => `absolute:${path}`;
it('eliminates avatar if it has had an attachment download error', () => {
@ -141,13 +142,13 @@ describe('Contact', () => {
organization: 'Somewhere, Inc.',
avatar: undefined,
firstNumber,
isNumberOnSignal,
uuid,
number: undefined,
};
const actual = embeddedContactSelector(contact, {
regionCode,
firstNumber,
isNumberOnSignal,
uuid,
getAbsoluteAttachmentPath,
});
assert.deepEqual(actual, expected);
@ -185,19 +186,21 @@ describe('Contact', () => {
}),
},
firstNumber,
isNumberOnSignal,
uuid,
number: undefined,
};
const actual = embeddedContactSelector(contact, {
regionCode,
firstNumber,
isNumberOnSignal,
uuid,
getAbsoluteAttachmentPath,
});
assert.deepEqual(actual, expected);
});
it('calculates absolute path', () => {
const fullUuid = UUID.generate().toString();
const contact = {
name: {
displayName: 'displayName',
@ -228,13 +231,13 @@ describe('Contact', () => {
}),
},
firstNumber,
isNumberOnSignal: true,
uuid: fullUuid,
number: undefined,
};
const actual = embeddedContactSelector(contact, {
regionCode,
firstNumber,
isNumberOnSignal: true,
uuid: fullUuid,
getAbsoluteAttachmentPath,
});
assert.deepEqual(actual, expected);