diff --git a/ts/session/utils/libsession/libsession_utils_contacts.ts b/ts/session/utils/libsession/libsession_utils_contacts.ts index 9283b684e..a7323414b 100644 --- a/ts/session/utils/libsession/libsession_utils_contacts.ts +++ b/ts/session/utils/libsession/libsession_utils_contacts.ts @@ -111,6 +111,7 @@ function setMappedValue(info: ContactInfo) { mappedContactWrapperValues.set(info.id, info); } +// TODO we should probably update the returned type as we only use the createdAt from the wrapper returned data function getContactCached(id: string) { return mappedContactWrapperValues.get(id); } diff --git a/ts/test/session/unit/messages/closed_groups/v3/GroupAdminGroupMessage_test.ts b/ts/test/session/unit/messages/closed_groups/v3/GroupAdminGroupMessage_test.ts deleted file mode 100644 index 0010e4741..000000000 --- a/ts/test/session/unit/messages/closed_groups/v3/GroupAdminGroupMessage_test.ts +++ /dev/null @@ -1,123 +0,0 @@ -// import { expect } from 'chai'; - -// import { SignalService } from '../../../../../../protobuf'; -// import { TestUtils } from '../../../../../test-utils'; -// import { GroupAdminGroupMessage } from '../../../../../../session/messages/outgoing/controlMessage/group/v3/GroupAdminGroupMessage'; -// import { v4 } from 'uuid'; -// import { Constants } from '../../../../../../session'; -// import { from_hex } from 'libsodium-wrappers-sumo'; - -describe('GroupAdminGroupMessage', () => { - // let groupPk: string; - // beforeEach(async () => { - // groupPk = TestUtils.generateFakeClosedGroupV3PkStr(); - // }); - // it('can create valid message with array of members', async () => { - // const member = TestUtils.generateFakePubKeyStr(); - // const message = new GroupAdminGroupMessage({ - // timestamp: 12345, - // identifier: v4(), - // members: [member], - // }); - // const plainText = message.plainTextBuffer(); - // const decoded = SignalService.Content.decode(plainText); - // expect(decoded.dataMessage) - // .to.have.property('groupMessage') - // .to.have.deep.property('publicKey', from_hex(groupPk)); - // expect(decoded.dataMessage) - // .to.have.property('closedGroupControlMessage') - // .to.have.deep.property('members', [member].map(from_hex)); - // expect(message) - // .to.have.property('timestamp') - // .to.be.equal(12345); - // }); - // it('correct ttl', () => { - // const message = new GroupAdminGroupMessage({ - // timestamp: 12345, - // identifier: v4(), - // members: [TestUtils.generateFakePubKeyStr()], - // }); - // expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX); - // }); - // it('has an identifier even if none are provided', () => { - // const message = new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: [TestUtils.generateFakePubKeyStr()], - // }); - // expect(message.identifier).to.not.equal(null, 'identifier cannot be null'); - // expect(message.identifier).to.not.equal(undefined, 'identifier cannot be undefined'); - // }); - // it('has the right type', () => { - // const message = new GroupAdminGroupMessage({ - // timestamp: 12345, - // identifier: v4(), - // members: [TestUtils.generateFakePubKeyStr()], - // }); - // const plainText = message.plainTextBuffer(); - // const decoded = SignalService.Content.decode(plainText); - // expect(decoded.dataMessage) - // .to.have.property('closedGroupControlMessage') - // .to.have.deep.property( - // 'type', - // SignalService.DataMessage.ClosedGroupControlMessage.Type.PROMOTE - // ); - // }); - // describe('constructor throws on invalid ', () => { - // it('groupPk empty', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: [TestUtils.generateFakePubKeyStr()], - // }); - // }).throws(); - // }); - // it('groupPk does not have group v3 prefix', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: [TestUtils.generateFakePubKeyStr()], - // }); - // }).throws(); - // }); - // it('groupPk does not have group v3 length', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: [TestUtils.generateFakePubKeyStr()], - // }); - // }).throws(); - // }); - // it('members is empty', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: undefined as any, - // }); - // }).throws(); - // }); - // it('members is not an Array', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: '05123456' as any, - // }); - // }).throws(); - // }); - // it('members array has one not a hex string', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: [TestUtils.generateFakePubKeyStr(), '05ggggggggggg'], - // }); - // }).throws(); - // }); - // it('members array has one item not a valid pubkey and not a `*`', () => { - // expect(() => { - // new GroupAdminGroupMessage({ - // timestamp: 12345, - // members: ['03opoerpero'], - // }); - // }).throws(); - // }); - // }); -}); diff --git a/ts/test/session/unit/messages/closed_groups/v3/GroupInviteMessage_test.ts b/ts/test/session/unit/messages/closed_groups/v3/GroupInviteMessage_test.ts deleted file mode 100644 index c5f39d889..000000000 --- a/ts/test/session/unit/messages/closed_groups/v3/GroupInviteMessage_test.ts +++ /dev/null @@ -1,89 +0,0 @@ -// import { expect } from 'chai'; - -// import { SignalService } from '../../../../../../protobuf'; -// import { GroupInviteMessage } from '../../../../../../session/messages/outgoing/controlMessage/group/v3/GroupInviteMessage'; -// import { v4 } from 'uuid'; -// import { Constants } from '../../../../../../session'; -// import { from_hex } from 'libsodium-wrappers-sumo'; - -// describe('GroupInviteMessage', () => { -// beforeEach(async () => {}); - -// it('can create valid message', async () => { -// const message = new GroupInviteMessage({ -// timestamp: 12345, -// memberPrivateKey: '654321', -// name: 'groupName', -// identifier: v4(), -// }); - -// const plainText = message.plainTextBuffer(); -// const decoded = SignalService.Content.decode(plainText); -// expect(decoded.dataMessage) -// .to.have.property('groupMessage') -// .to.have.property('inviteMessage') -// .to.have.deep.property('name', 'groupName'); -// expect(decoded.dataMessage) -// .to.have.property('groupMessage') -// .to.have.property('inviteMessage') -// .to.have.deep.property('memberPrivateKey', from_hex('654321')); - -// expect(message) -// .to.have.property('timestamp') -// .to.be.equal(12345); -// }); - -// it('correct ttl', () => { -// const message = new GroupInviteMessage({ -// timestamp: 12345, -// memberPrivateKey: '654321', -// name: 'groupName', -// identifier: v4(), -// }); - -// expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX); -// }); - -// it('has an identifier even if none are provided', () => { -// const message = new GroupInviteMessage({ -// timestamp: 12345, -// memberPrivateKey: '654321', -// name: 'groupName', -// }); - -// expect(message.identifier).to.not.equal(null, 'identifier cannot be null'); -// expect(message.identifier).to.not.equal(undefined, 'identifier cannot be undefined'); -// }); - -// describe('constructor throws on invalid ', () => { -// it('memberPk is empty', () => { -// expect(() => { -// new GroupInviteMessage({ -// timestamp: 12345, -// memberPrivateKey: undefined as any, -// name: 'groupName', -// }); -// }).throws(); -// }); - -// it('memberPk is not a string', () => { -// expect(() => { -// new GroupInviteMessage({ -// timestamp: 12345, -// memberPrivateKey: 1234 as any, -// name: 'groupName', -// }); -// }).throws(); -// }); - -// it('memberPk is not a hex string', () => { -// expect(() => { -// new GroupInviteMessage({ -// timestamp: 12345, -// memberPrivateKey: '03ghklmnopqrstuvxyz' as any, -// name: 'groupName', -// }); -// }).throws(); -// }); -// }); -// }); diff --git a/ts/test/session/unit/messages/closed_groups/v3/GroupMemberLeftMessage_test.ts b/ts/test/session/unit/messages/closed_groups/v3/GroupMemberLeftMessage_test.ts deleted file mode 100644 index e3e50c3f8..000000000 --- a/ts/test/session/unit/messages/closed_groups/v3/GroupMemberLeftMessage_test.ts +++ /dev/null @@ -1,52 +0,0 @@ -// import { expect } from 'chai'; - -// import { SignalService } from '../../../../../../protobuf'; -// import { v4 } from 'uuid'; -// import { Constants } from '../../../../../../session'; -// import { GroupMemberLeftMessage } from '../../../../../../session/messages/outgoing/controlMessage/group/v3/GroupMemberLeftMessage'; - -// describe('GroupMemberLeftMessage', () => { -// beforeEach(async () => {}); - -// it('can create valid message', async () => { -// const message = new GroupMemberLeftMessage({ -// timestamp: 12345, -// identifier: v4(), -// }); - -// const plainText = message.plainTextBuffer(); -// const decoded = SignalService.Content.decode(plainText); -// expect(decoded.dataMessage) -// .to.have.property('groupMessage') -// .to.have.property('memberLeftMessage').to.be.not.undefined; -// expect(decoded.dataMessage) -// .to.have.property('groupMessage') -// .to.have.property('memberLeftMessage').to.be.not.null; - -// expect(decoded.dataMessage) -// .to.have.property('groupMessage') -// .to.have.property('memberLeftMessage').to.be.empty; -// expect(message) -// .to.have.property('timestamp') -// .to.be.equal(12345); -// }); - -// it('correct ttl', () => { -// const message = new GroupMemberLeftMessage({ -// timestamp: 12345, -// identifier: v4(), -// }); - -// expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX); -// }); - -// it('has an identifier even if none are provided', () => { -// const message = new GroupMemberLeftMessage({ -// timestamp: 12345, -// }); - -// expect(message.identifier).to.not.equal(null, 'identifier cannot be null'); -// expect(message.identifier).to.not.equal(undefined, 'identifier cannot be undefined'); -// }); - -// }); diff --git a/ts/test/session/unit/messages/closed_groups/v3/GroupPromoteMessage_test.ts b/ts/test/session/unit/messages/closed_groups/v3/GroupPromoteMessage_test.ts deleted file mode 100644 index c50503382..000000000 --- a/ts/test/session/unit/messages/closed_groups/v3/GroupPromoteMessage_test.ts +++ /dev/null @@ -1,60 +0,0 @@ -// import { expect } from 'chai'; - -// import { SignalService } from '../../../../../../protobuf'; -// import { GroupPromoteMessage } from '../../../../../../session/messages/outgoing/controlMessage/group/v3/GroupPromoteMessage'; -// import { v4 } from 'uuid'; -// import { Constants } from '../../../../../../session'; -// import { from_hex } from 'libsodium-wrappers-sumo'; - -// describe('GroupPromoteMessage', () => { -// beforeEach(async () => {}); - -// it('can create valid message', async () => { -// const message = new GroupPromoteMessage({ -// timestamp: 12345, -// identifier: v4(), -// privateKey: '1234', -// }); - -// const plainText = message.plainTextBuffer(); -// const decoded = SignalService.Content.decode(plainText); -// expect(decoded.dataMessage) -// .to.have.property('groupMessage') -// .to.have.property('promoteMessage') -// .to.have.deep.property('privateKey', from_hex('1234')); -// expect(message) -// .to.have.property('timestamp') -// .to.be.equal(12345); -// }); - -// it('correct ttl', () => { -// const message = new GroupPromoteMessage({ -// timestamp: 12345, -// identifier: v4(), -// privateKey: '1234', -// }); - -// expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX); -// }); - -// it('has an identifier even if none are provided', () => { -// const message = new GroupPromoteMessage({ -// timestamp: 12345, -// privateKey: '1234', -// }); - -// expect(message.identifier).to.not.equal(null, 'identifier cannot be null'); -// expect(message.identifier).to.not.equal(undefined, 'identifier cannot be undefined'); -// }); - -// describe('constructor throws on invalid ', () => { -// it('privateKey empty', () => { -// expect(() => { -// new GroupPromoteMessage({ -// timestamp: 12345, -// privateKey: null as any, -// }); -// }).throws(); -// }); -// }); -// });