review PR

pull/1495/head
Audric Ackermann 4 years ago
parent 8eb1507fcf
commit 850233bc9e

@ -196,7 +196,7 @@ async function importConversationsFromJSON(conversations, options) {
); );
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
await window.Signal.Data.saveConversation(migrated, { await window.Signal.Data.saveConversation(migrated, {
Conversation: window.Wh, Conversation: window.models.Conversation.ConversationModel,
}); });
} }

@ -1,4 +1,5 @@
import { KeyPair } from '../../libtextsecure/libsignal-protocol'; import { KeyPair } from '../../libtextsecure/libsignal-protocol';
import { MessageCollection } from '../../ts/models/message';
import { HexKeyPair } from '../../ts/receiver/closedGroups'; import { HexKeyPair } from '../../ts/receiver/closedGroups';
import { PubKey } from '../../ts/session/types'; import { PubKey } from '../../ts/session/types';
import { ConversationType } from '../../ts/state/ducks/conversations'; import { ConversationType } from '../../ts/state/ducks/conversations';
@ -242,8 +243,7 @@ export function getUnreadByConversation(
{ MessageCollection }?: any { MessageCollection }?: any
): Promise<any>; ): Promise<any>;
export function getUnreadCountByConversation( export function getUnreadCountByConversation(
conversationId: string, conversationId: string
{ MessageCollection }?: any
): Promise<any>; ): Promise<any>;
export function removeAllMessagesInConversation( export function removeAllMessagesInConversation(
conversationId: string, conversationId: string,
@ -261,7 +261,7 @@ export function getMessageBySender(
export function getMessagesBySender( export function getMessagesBySender(
{ source, sourceDevice }: { source: any; sourceDevice: any }, { source, sourceDevice }: { source: any; sourceDevice: any },
{ Message }: { Message: any } { Message }: { Message: any }
): Promise<window.models.Message.MessageCollection>; ): Promise<MessageCollection>;
export function getMessageIdsFromServerIds( export function getMessageIdsFromServerIds(
serverIds: any, serverIds: any,
conversationId: any conversationId: any

@ -98,7 +98,7 @@ const sendMessageStyle = {
input: { input: {
overflow: 'auto', overflow: 'auto',
maxHeight: 70, maxHeight: 70,
wordBreak: 'break-all', wordBreak: 'break-word',
padding: '0px', padding: '0px',
margin: '0px', margin: '0px',
}, },

@ -54,7 +54,7 @@ async function handleGroups(
// Check if anyone got kicked: // Check if anyone got kicked:
const removedMembers = _.difference(oldMembers, attributes.members); const removedMembers = _.difference(oldMembers, attributes.members);
const ourDeviceWasRemoved = removedMembers.some(async member => const ourDeviceWasRemoved = removedMembers.some(member =>
UserUtils.isUsFromCache(member) UserUtils.isUsFromCache(member)
); );

@ -167,13 +167,11 @@ describe('MessageEncrypter', () => {
it('should throw an error for anything else than Fallback or ClosedGroup', () => { it('should throw an error for anything else than Fallback or ClosedGroup', () => {
const data = crypto.randomBytes(10); const data = crypto.randomBytes(10);
expect( return MessageEncrypter.encrypt(
MessageEncrypter.encrypt( TestUtils.generateFakePubKey(),
TestUtils.generateFakePubKey(), data,
data, EncryptionType.Signal
EncryptionType.Signal ).should.eventually.be.rejectedWith(Error);
)
).to.be.rejectedWith(Error);
}); });
}); });
}); });

@ -8,6 +8,7 @@ import { PromiseUtils } from '../../../../session/utils';
// tslint:disable-next-line: no-require-imports no-var-requires // tslint:disable-next-line: no-require-imports no-var-requires
import chaiAsPromised from 'chai-as-promised'; import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised as any); chai.use(chaiAsPromised as any);
chai.should();
const { expect } = chai; const { expect } = chai;
@ -51,10 +52,10 @@ describe('Promise Utils', () => {
}; };
const promise = PromiseUtils.poll(task, {}); const promise = PromiseUtils.poll(task, {});
await promise;
expect(pollSpy.callCount).to.equal(1); expect(pollSpy.callCount).to.equal(1);
expect(completionSpy.callCount).to.equal(1); expect(completionSpy.callCount).to.equal(1);
return promise;
}); });
it('can timeout a task', () => { it('can timeout a task', () => {
@ -64,9 +65,11 @@ describe('Promise Utils', () => {
const promise = PromiseUtils.poll(task, { timeoutMs: 1 }); const promise = PromiseUtils.poll(task, { timeoutMs: 1 });
promise.should.eventually.be.rejectedWith('Periodic check timeout');
expect(pollSpy.callCount).to.equal(1); expect(pollSpy.callCount).to.equal(1);
expect(completionSpy.callCount).to.equal(0); expect(completionSpy.callCount).to.equal(0);
return promise.should.eventually.be.rejectedWith(
'Periodic check timeout'
);
}); });
it('will recur according to interval option', async () => { it('will recur according to interval option', async () => {
@ -105,9 +108,9 @@ describe('Promise Utils', () => {
const promise = PromiseUtils.waitForTask(task); const promise = PromiseUtils.waitForTask(task);
await promise;
expect(waitForTaskSpy.callCount).to.equal(1); expect(waitForTaskSpy.callCount).to.equal(1);
expect(completionSpy.callCount).to.equal(1); expect(completionSpy.callCount).to.equal(1);
return promise;
}); });
it('can timeout a task', () => { it('can timeout a task', () => {
@ -117,9 +120,9 @@ describe('Promise Utils', () => {
const promise = PromiseUtils.waitForTask(task, 1); const promise = PromiseUtils.waitForTask(task, 1);
promise.should.eventually.be.rejectedWith('Task timed out.');
expect(waitForTaskSpy.callCount).to.equal(1); expect(waitForTaskSpy.callCount).to.equal(1);
expect(completionSpy.callCount).to.equal(0); expect(completionSpy.callCount).to.equal(0);
return promise.should.eventually.be.rejectedWith('Task timed out.');
}); });
}); });
@ -127,17 +130,19 @@ describe('Promise Utils', () => {
it('can wait for check', async () => { it('can wait for check', async () => {
const check = () => true; const check = () => true;
const promise = PromiseUtils.waitUntil(check); const promise = PromiseUtils.waitUntil(check);
await promise;
expect(waitUntilSpy.callCount).to.equal(1); expect(waitUntilSpy.callCount).to.equal(1);
return promise;
}); });
it('can timeout a check', () => { it('can timeout a check', () => {
const check = () => false; const check = () => false;
const promise = PromiseUtils.waitUntil(check, 1); const promise = PromiseUtils.waitUntil(check, 1);
promise.should.eventually.be.rejectedWith('Periodic check timeout');
expect(waitUntilSpy.callCount).to.equal(1); expect(waitUntilSpy.callCount).to.equal(1);
return promise.should.eventually.be.rejectedWith(
'Periodic check timeout'
);
}); });
}); });
}); });

Loading…
Cancel
Save