pull/1153/head
Mikunj 5 years ago
parent 2e02e7d67b
commit 4704893649

@ -5,18 +5,18 @@ import * as sinon from 'sinon';
import * as window from '../../../window'; import * as window from '../../../window';
import { MessageEncrypter } from '../../../session/crypto'; import { MessageEncrypter } from '../../../session/crypto';
import { EncryptionType } from '../../../session/types/EncryptionType'; import { EncryptionType } from '../../../session/types/EncryptionType';
import * as stubs from '../../utils/stubs'; import { Stubs } from '../../test-utils';
import { TestUtils } from '../../utils'; import { UserUtil } from '../../../util';
describe('MessageEncrypter', () => { describe('MessageEncrypter', () => {
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();
let sessionCipherStub: MockManager<stubs.SessionCipherBasicStub>; let sessionCipherStub: MockManager<Stubs.SessionCipherBasicStub>;
beforeEach(() => { beforeEach(() => {
sessionCipherStub = ImportMock.mockClass(stubs, 'SessionCipherBasicStub'); sessionCipherStub = ImportMock.mockClass(Stubs, 'SessionCipherBasicStub');
ImportMock.mockOther(window, 'libsignal', { ImportMock.mockOther(window, 'libsignal', {
SignalProtocolAddress: sandbox.stub(), SignalProtocolAddress: sandbox.stub(),
SessionCipher: stubs.SessionCipherBasicStub, SessionCipher: Stubs.SessionCipherBasicStub,
} as any); } as any);
ImportMock.mockOther(window, 'textsecure', { ImportMock.mockOther(window, 'textsecure', {
@ -25,12 +25,7 @@ describe('MessageEncrypter', () => {
}, },
}); });
TestUtils.mockData('getItemById', undefined) ImportMock.mockFunction(UserUtil, 'getCurrentDevicePubKey', '1');
.withArgs('number_id')
.resolves({
id: 'number_id',
value: 'abc.1',
});
}); });
afterEach(() => { afterEach(() => {

@ -1,7 +1,7 @@
import chai from 'chai'; import chai from 'chai';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { JobQueue } from '../../../session/utils/JobQueue'; import { JobQueue } from '../../../session/utils/JobQueue';
import { timeout } from '../../utils/timeout'; import { timeout } from '../../test-utils';
// tslint:disable-next-line: no-require-imports no-var-requires // tslint:disable-next-line: no-require-imports no-var-requires
const chaiAsPromised = require('chai-as-promised'); const chaiAsPromised = require('chai-as-promised');

@ -0,0 +1,5 @@
import * as TestUtils from './testUtils';
import * as Stubs from './stubs';
export * from './timeout';
export { TestUtils, Stubs };

@ -1,3 +0,0 @@
import * as TestUtils from './testUtils';
export { TestUtils };
Loading…
Cancel
Save