30 test failures to go :D

This commit is contained in:
Michael Telatynski 2019-12-16 11:12:48 +00:00
parent ffa2ac172c
commit 6ad31fe023
33 changed files with 424 additions and 709 deletions

View file

@ -139,7 +139,6 @@
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-hooks": "^2.0.1",
"estree-walker": "^0.5.0",
"expect": "^24.1.0",
"file-loader": "^3.0.1",
"flow-parser": "^0.57.3",
"jest": "^23.2.0",
@ -158,11 +157,11 @@
"react-test-renderer": "^16.9.0",
"require-json": "0.0.1",
"rimraf": "^2.4.3",
"sinon": "^5.0.7",
"source-map-loader": "^0.2.3",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.9.0",
"subtle": "^0.1.8",
"walk": "^2.3.9",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1"

View file

@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import { DecryptionFailure, DecryptionFailureTracker } from '../src/DecryptionFailureTracker';
import { MatrixEvent } from 'matrix-js-sdk';

View file

@ -11,7 +11,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import {phasedRollOutExpiredForUser} from '../src/PhasedRollOut';
const OFFSET = 6000000;

View file

@ -14,43 +14,41 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import sinon from 'sinon';
import ScalarAuthClient from '../src/ScalarAuthClient';
import MatrixClientPeg from '../src/MatrixClientPeg';
import { stubClient } from './test-utils';
describe('ScalarAuthClient', function() {
let clientSandbox;
beforeEach(function() {
sinon.stub(window.localStorage, 'getItem').withArgs('mx_scalar_token').returns('brokentoken');
clientSandbox = stubClient();
});
afterEach(function() {
clientSandbox.restore();
sinon.restore();
window.localStorage.getItem = jest.fn((arg) => {
if (arg === "mx_scalar_token") return "brokentoken";
});
stubClient();
});
it('should request a new token if the old one fails', async function() {
const sac = new ScalarAuthClient();
sac._getAccountName = sinon.stub();
sac._getAccountName.withArgs('brokentoken').rejects({
message: "Invalid token",
sac._getAccountName = jest.fn((arg) => {
switch (arg) {
case "brokentoken":
return Promise.reject({
message: "Invalid token",
});
case "wokentoken":
return Promise.resolve(MatrixClientPeg.get().getUserId());
}
});
sac._getAccountName.withArgs('wokentoken').resolves(MatrixClientPeg.get().getUserId());
MatrixClientPeg.get().getOpenIdToken = sinon.stub().resolves('this is your openid token');
MatrixClientPeg.get().getOpenIdToken = jest.fn().mockResolvedValue('this is your openid token');
sac.exchangeForScalarToken = sinon.stub().withArgs('this is your openid token').resolves('wokentoken');
sac.exchangeForScalarToken = jest.fn((arg) => {
if (arg === "this is your openid token") return Promise.resolve("wokentoken");
});
await sac.connect();
expect(sac.exchangeForScalarToken.calledWith('this is your openid token')).toBeTruthy();
expect(sac.exchangeForScalarToken).toBeCalledWith('this is your openid token');
expect(sac.scalarToken).toEqual('wokentoken');
});
});

View file

@ -14,10 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import sinon from 'sinon';
import * as Matrix from 'matrix-js-sdk';
import { startTermsFlow, Service } from '../src/Terms';
@ -44,107 +40,100 @@ const IM_SERVICE_ONE = new Service(Matrix.SERVICE_TYPES.IM, 'https://imone.test'
const IM_SERVICE_TWO = new Service(Matrix.SERVICE_TYPES.IM, 'https://imtwo.test', 'a token token');
describe('Terms', function() {
let sandbox;
beforeEach(function() {
sandbox = stubClient();
});
afterEach(function() {
sandbox.restore();
stubClient();
});
it('should prompt for all terms & services if no account data', async function() {
MatrixClientPeg.get().getAccountData = sinon.stub().returns(null);
MatrixClientPeg.get().getTerms = sinon.stub().returns({
MatrixClientPeg.get().getAccountData = jest.fn().mockReturnValue(null);
MatrixClientPeg.get().getTerms = jest.fn().mockReturnValue({
policies: {
"policy_the_first": POLICY_ONE,
},
});
const interactionCallback = sinon.stub().resolves([]);
const interactionCallback = jest.fn().mockResolvedValue([]);
await startTermsFlow([IM_SERVICE_ONE], interactionCallback);
console.log("interaction callback calls", interactionCallback.getCall(0));
console.log("interaction callback calls", interactionCallback.mock.calls[0]);
expect(interactionCallback.calledWith([
expect(interactionCallback).toBeCalledWith([
{
service: IM_SERVICE_ONE,
policies: {
policy_the_first: POLICY_ONE,
},
},
])).toBeTruthy();
], []);
});
it('should not prompt if all policies are signed in account data', async function() {
MatrixClientPeg.get().getAccountData = sinon.stub().returns({
getContent: sinon.stub().returns({
MatrixClientPeg.get().getAccountData = jest.fn().mockReturnValue({
getContent: jest.fn().mockReturnValue({
accepted: ["http://example.com/one"],
}),
});
MatrixClientPeg.get().getTerms = sinon.stub().returns({
MatrixClientPeg.get().getTerms = jest.fn().mockReturnValue({
policies: {
"policy_the_first": POLICY_ONE,
},
});
MatrixClientPeg.get().agreeToTerms = sinon.stub();
MatrixClientPeg.get().agreeToTerms = jest.fn();
const interactionCallback = sinon.spy();
const interactionCallback = jest.fn();
await startTermsFlow([IM_SERVICE_ONE], interactionCallback);
console.log("agreeToTerms call", MatrixClientPeg.get().agreeToTerms.getCall(0).args);
console.log("agreeToTerms call", MatrixClientPeg.get().agreeToTerms.mock.calls[0]);
expect(interactionCallback.called).toBeFalsy();
expect(MatrixClientPeg.get().agreeToTerms.calledWith(
expect(interactionCallback).not.toHaveBeenCalled();
expect(MatrixClientPeg.get().agreeToTerms).toBeCalledWith(
Matrix.SERVICE_TYPES.IM,
'https://imone.test',
'a token token',
["http://example.com/one"],
)).toBeTruthy();
);
});
it("should prompt for only terms that aren't already signed", async function() {
MatrixClientPeg.get().getAccountData = sinon.stub().returns({
getContent: sinon.stub().returns({
MatrixClientPeg.get().getAccountData = jest.fn().mockReturnValue({
getContent: jest.fn().mockReturnValue({
accepted: ["http://example.com/one"],
}),
});
MatrixClientPeg.get().getTerms = sinon.stub().returns({
MatrixClientPeg.get().getTerms = jest.fn().mockReturnValue({
policies: {
"policy_the_first": POLICY_ONE,
"policy_the_second": POLICY_TWO,
},
});
MatrixClientPeg.get().agreeToTerms = sinon.stub();
MatrixClientPeg.get().agreeToTerms = jest.fn();
const interactionCallback = sinon.stub().resolves(["http://example.com/one", "http://example.com/two"]);
const interactionCallback = jest.fn().mockResolvedValue(["http://example.com/one", "http://example.com/two"]);
await startTermsFlow([IM_SERVICE_ONE], interactionCallback);
console.log("interactionCallback call", interactionCallback.getCall(0).args);
console.log("agreeToTerms call", MatrixClientPeg.get().agreeToTerms.getCall(0).args);
console.log("interactionCallback call", interactionCallback.mock.calls[0]);
console.log("agreeToTerms call", MatrixClientPeg.get().agreeToTerms.mock.calls[0]);
expect(interactionCallback.calledWith([
expect(interactionCallback).toBeCalledWith([
{
service: IM_SERVICE_ONE,
policies: {
policy_the_second: POLICY_TWO,
},
},
])).toBeTruthy();
expect(MatrixClientPeg.get().agreeToTerms.calledWith(
], ["http://example.com/one"]);
expect(MatrixClientPeg.get().agreeToTerms).toBeCalledWith(
Matrix.SERVICE_TYPES.IM,
'https://imone.test',
'a token token',
["http://example.com/one", "http://example.com/two"],
)).toBeTruthy();
);
});
it("should prompt for only services with un-agreed policies", async function() {
MatrixClientPeg.get().getAccountData = sinon.stub().returns({
getContent: sinon.stub().returns({
MatrixClientPeg.get().getAccountData = jest.fn().mockReturnValue({
getContent: jest.fn().mockReturnValue({
accepted: ["http://example.com/one"],
}),
});
MatrixClientPeg.get().getTerms = sinon.stub();
MatrixClientPeg.get().getTerms.callsFake((serviceType, baseUrl, accessToken) => {
MatrixClientPeg.get().getTerms = jest.fn((serviceType, baseUrl, accessToken) => {
switch (baseUrl) {
case 'https://imone.test':
return {
@ -161,35 +150,35 @@ describe('Terms', function() {
}
});
MatrixClientPeg.get().agreeToTerms = sinon.stub();
MatrixClientPeg.get().agreeToTerms = jest.fn();
const interactionCallback = sinon.stub().resolves(["http://example.com/one", "http://example.com/two"]);
const interactionCallback = jest.fn().mockResolvedValue(["http://example.com/one", "http://example.com/two"]);
await startTermsFlow([IM_SERVICE_ONE, IM_SERVICE_TWO], interactionCallback);
console.log("getTerms call 0", MatrixClientPeg.get().getTerms.getCall(0).args);
console.log("getTerms call 1", MatrixClientPeg.get().getTerms.getCall(1).args);
console.log("interactionCallback call", interactionCallback.getCall(0).args);
console.log("agreeToTerms call", MatrixClientPeg.get().agreeToTerms.getCall(0).args);
// console.log("getTerms call 0", MatrixClientPeg.get().getTerms.getCall(0).args);
// console.log("getTerms call 1", MatrixClientPeg.get().getTerms.getCall(1).args);
// console.log("interactionCallback call", interactionCallback.getCall(0).args);
// console.log("agreeToTerms call", MatrixClientPeg.get().agreeToTerms.getCall(0).args);
expect(interactionCallback.calledWith([
expect(interactionCallback).toBeCalledWith([
{
service: IM_SERVICE_TWO,
policies: {
policy_the_second: POLICY_TWO,
},
},
])).toBeTruthy();
expect(MatrixClientPeg.get().agreeToTerms.calledWith(
], ["http://example.com/one"]);
expect(MatrixClientPeg.get().agreeToTerms).toBeCalledWith(
Matrix.SERVICE_TYPES.IM,
'https://imone.test',
'a token token',
["http://example.com/one"],
)).toBeTruthy();
expect(MatrixClientPeg.get().agreeToTerms.calledWith(
);
expect(MatrixClientPeg.get().agreeToTerms).toBeCalledWith(
Matrix.SERVICE_TYPES.IM,
'https://imtwo.test',
'a token token',
["http://example.com/two"],
)).toBeTruthy();
);
});
});

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import lolex from 'lolex';
import jest from 'jest-mock';
import EventEmitter from 'events';

View file

@ -1,7 +0,0 @@
// all-tests.js
//
// Our master test file: uses the webpack require API to find our test files
// and run them
const context = require.context('.', true, /-test\.jsx?$/);
context.keys().forEach(context);

View file

@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import QueryMatcher from '../../src/autocomplete/QueryMatcher';
const OBJECTS = [

View file

@ -17,14 +17,13 @@ limitations under the License.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import expect from 'expect';
import MockHttpBackend from 'matrix-mock-request';
import MatrixClientPeg from '../../../src/MatrixClientPeg';
import sdk from 'matrix-react-sdk';
import sdk from '../../skinned-sdk';
import Matrix from 'matrix-js-sdk';
import * as TestUtils from 'test-utils';
import * as TestUtils from '../../test-utils';
const { waitForUpdate } = TestUtils;
const GroupView = sdk.getComponent('structures.GroupView');

View file

@ -23,10 +23,9 @@ import ReactDOM from "react-dom";
import PropTypes from "prop-types";
const TestUtils = require('react-dom/test-utils');
const expect = require('expect');
import sinon from 'sinon';
import { EventEmitter } from "events";
const sdk = require('matrix-react-sdk');
import sdk from '../../skinned-sdk';
const MessagePanel = sdk.getComponent('structures.MessagePanel');
import MatrixClientPeg from '../../../src/MatrixClientPeg';
@ -72,15 +71,14 @@ describe('MessagePanel', function() {
const clock = mockclock.clock();
const realSetTimeout = window.setTimeout;
const events = mkEvents();
let sandbox = null;
beforeEach(function() {
sandbox = test_utils.stubClient();
test_utils.stubClient();
client = MatrixClientPeg.get();
client.credentials = {userId: '@me:here'};
// HACK: We assume all settings want to be disabled
SettingsStore.getValue = sinon.stub().returns(false);
SettingsStore.getValue = jest.fn().returns(false);
SettingsStore.getValue.withArgs('showDisplaynameChanges').returns(true);
// This option clobbers the duration of all animations to be 1ms
@ -94,7 +92,6 @@ describe('MessagePanel', function() {
delete Velocity.mock;
clock.uninstall();
sandbox.restore();
});
function mkEvents() {

View file

@ -14,12 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import sinon from 'sinon';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
import SdkConfig from '../../../../src/SdkConfig';
import {mkServerConfig} from "../../../test-utils";
@ -36,7 +34,6 @@ describe('Login', function() {
});
afterEach(function() {
sinon.restore();
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
});
@ -72,7 +69,7 @@ describe('Login', function() {
});
it('should show form without change server link when custom URLs disabled', function() {
sinon.stub(SdkConfig, "get").returns({
jest.spyOn(SdkConfig, "get").returns({
disable_custom_urls: true,
});

View file

@ -14,12 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import sinon from 'sinon';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
import SdkConfig from '../../../../src/SdkConfig';
import {mkServerConfig} from "../../../test-utils";
@ -36,7 +34,6 @@ describe('Registration', function() {
});
afterEach(function() {
sinon.restore();
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
});
@ -61,7 +58,7 @@ describe('Registration', function() {
});
it('should show form when custom URLs disabled', function() {
sinon.stub(SdkConfig, "get").returns({
jest.spyOn(SdkConfig, "get").returns({
disable_custom_urls: true,
});

View file

@ -14,14 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import sinon from 'sinon';
import MatrixReactTestUtils from 'matrix-react-test-utils';
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
import * as test_utils from '../../../test-utils';
@ -33,10 +31,9 @@ const InteractiveAuthDialog = sdk.getComponent(
describe('InteractiveAuthDialog', function() {
let parentDiv;
let sandbox;
beforeEach(function() {
sandbox = test_utils.stubClient(sandbox);
test_utils.stubClient();
parentDiv = document.createElement('div');
document.body.appendChild(parentDiv);
});
@ -44,12 +41,11 @@ describe('InteractiveAuthDialog', function() {
afterEach(function() {
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
sandbox.restore();
});
it('Should successfully complete a password flow', function() {
const onFinished = sinon.spy();
const doRequest = sinon.stub().returns(Promise.resolve({a: 1}));
const onFinished = jest.fn();
const doRequest = jest.fn().mockResolvedValue({a: 1});
// tell the stub matrixclient to return a real userid
const client = MatrixClientPeg.get();
@ -108,8 +104,8 @@ describe('InteractiveAuthDialog', function() {
// let the request complete
return sleep(1);
}).then(() => {
expect(onFinished.callCount).toEqual(1);
expect(onFinished.calledWithExactly(true, {a: 1})).toBe(true);
expect(onFinished).toBeCalledTimes(1);
expect(onFinished).toBeCalledWith(true, {a: 1});
});
});
});

View file

@ -1,8 +1,7 @@
import expect from 'expect';
import React from 'react';
import ReactTestUtils from 'react-dom/test-utils';
import ShallowRenderer from "react-test-renderer/shallow";
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
import * as languageHandler from '../../../../src/languageHandler';
import * as testUtils from '../../../test-utils';
@ -12,8 +11,6 @@ const MemberEventListSummary = testUtils.wrapInMatrixClientContext(
);
describe('MemberEventListSummary', function() {
let sandbox;
// Generate dummy event tiles for use in simulating an expanded MELS
const generateTiles = (events) => {
return events.map((e) => {
@ -88,7 +85,7 @@ describe('MemberEventListSummary', function() {
};
beforeEach(function(done) {
sandbox = testUtils.stubClient();
testUtils.stubClient();
languageHandler.setLanguage('en').then(done);
languageHandler.setMissingEntryGenerator(function(key) {
@ -96,10 +93,6 @@ describe('MemberEventListSummary', function() {
});
});
afterEach(function() {
sandbox.restore();
});
it('renders expanded events if there are less than props.threshold', function() {
const events = generateEvents([
{userId: "@user_1:some.domain", prevMembership: "leave", membership: "join"},

View file

@ -17,14 +17,13 @@ limitations under the License.
import React from "react";
import ReactDOM from "react-dom";
import ReactTestUtils from "react-dom/test-utils";
import expect from "expect";
import MockHttpBackend from "matrix-mock-request";
import MatrixClientPeg from "../../../../src/MatrixClientPeg";
import sdk from "matrix-react-sdk";
import sdk from "../../../skinned-sdk";
import Matrix from "matrix-js-sdk";
import * as TestUtils from "test-utils";
import * as TestUtils from "../../../test-utils";
const { waitForUpdate } = TestUtils;
const GroupMemberList = sdk.getComponent("views.groups.GroupMemberList");

View file

@ -1,10 +1,9 @@
import React from 'react';
import ReactTestUtils from 'react-dom/test-utils';
import ReactDOM from 'react-dom';
import expect from 'expect';
import lolex from 'lolex';
import * as TestUtils from 'test-utils';
import * as TestUtils from '../../../test-utils';
import sdk from '../../../../src/index';
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
@ -26,7 +25,6 @@ describe('MemberList', () => {
}
let parentDiv = null;
let sandbox = null;
let client = null;
let root = null;
let clock = null;
@ -38,7 +36,7 @@ describe('MemberList', () => {
let defaultUsers = [];
beforeEach(function() {
sandbox = TestUtils.stubClient(sandbox);
TestUtils.stubClient();
client = MatrixClientPeg.get();
client.hasLazyLoadMembersEnabled = () => false;
@ -115,7 +113,6 @@ describe('MemberList', () => {
parentDiv.remove();
parentDiv = null;
}
sandbox.restore();
clock.uninstall();

View file

@ -1,10 +1,8 @@
import React from 'react';
import ReactTestUtils from 'react-dom/test-utils';
import ReactDOM from 'react-dom';
import expect from 'expect';
import sinon from 'sinon';
import * as testUtils from '../../../test-utils';
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
const MessageComposerInput = sdk.getComponent('views.rooms.MessageComposerInput');
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
import {sleep} from "../../../../src/utils/promise";
@ -23,13 +21,12 @@ function addTextToDraft(text) {
xdescribe('MessageComposerInput', () => {
let parentDiv = null,
sandbox = null,
client = null,
mci = null,
room = testUtils.mkStubRoom('!DdJkzRliezrwpNebLk:matrix.org');
beforeEach(function() {
sandbox = testUtils.stubClient(sandbox);
testUtils.stubClient();
client = MatrixClientPeg.get();
client.credentials = {userId: '@me:domain.com'};
@ -54,7 +51,6 @@ xdescribe('MessageComposerInput', () => {
parentDiv.remove();
parentDiv = null;
}
sandbox.restore();
done();
});
});
@ -75,66 +71,66 @@ xdescribe('MessageComposerInput', () => {
});
it('should not send messages when composer is empty', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(true);
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(false, 'should not send message');
expect(spy).not.toBeCalled();
});
it('should not change content unnecessarily on RTE -> Markdown conversion', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(true);
addTextToDraft('a');
mci.handleKeyCommand('toggle-mode');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('a');
});
it('should not change content unnecessarily on Markdown -> RTE conversion', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('a');
mci.handleKeyCommand('toggle-mode');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('a');
});
it('should send emoji messages when rich text is enabled', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(true);
addTextToDraft('☹');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true, 'should send message');
});
it('should send emoji messages when Markdown is enabled', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('☹');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true, 'should send message');
});
// FIXME
// it('should convert basic Markdown to rich text correctly', () => {
// const spy = sinon.spy(client, 'sendHtmlMessage');
// const spy = jest.spyOn(client, 'sendHtmlMessage');
// mci.enableRichtext(false);
// addTextToDraft('*abc*');
// mci.handleKeyCommand('toggle-mode');
// mci.handleReturn(sinon.stub());
// mci.handleReturn(jest.fn());
// console.error(spy.args[0][2]);
// expect(spy.args[0][2]).toContain('<em>abc');
// });
//
// it('should convert basic rich text to Markdown correctly', () => {
// const spy = sinon.spy(client, 'sendHtmlMessage');
// const spy = jest.spyOn(client, 'sendHtmlMessage');
// mci.enableRichtext(true);
// process.nextTick(() => {
//
@ -142,43 +138,43 @@ xdescribe('MessageComposerInput', () => {
// mci.handleKeyCommand('italic');
// addTextToDraft('abc');
// mci.handleKeyCommand('toggle-mode');
// mci.handleReturn(sinon.stub());
// mci.handleReturn(jest.fn());
// expect(['_abc_', '*abc*']).toContain(spy.args[0][1]);
// });
it('should insert formatting characters in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
mci.handleKeyCommand('italic');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(['__', '**']).toContain(spy.args[0][1].body);
});
it('should not entity-encode " in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('"');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('"');
});
it('should escape characters without other markup in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('\\*escaped\\*');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('*escaped*');
});
it('should escape characters with other markup in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('\\*escaped\\* *italic*');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('\\*escaped\\* *italic*');
@ -186,20 +182,20 @@ xdescribe('MessageComposerInput', () => {
});
it('should not convert -_- into a horizontal rule in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('-_-');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('-_-');
});
it('should not strip <del> tags in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('<del>striked-out</del>');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('<del>striked-out</del>');
@ -207,30 +203,30 @@ xdescribe('MessageComposerInput', () => {
});
it('should not strike-through ~~~ in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('~~~striked-out~~~');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('~~~striked-out~~~');
});
it('should not mark single unmarkedup paragraphs as HTML in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');
});
it('should not mark two unmarkedup paragraphs as HTML in Markdown mode', () => {
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
addTextToDraft('Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nFusce congue sapien sed neque molestie volutpat.');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.calledOnce).toEqual(true);
expect(spy.args[0][1].body).toEqual('Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nFusce congue sapien sed neque molestie volutpat.');
@ -238,7 +234,7 @@ xdescribe('MessageComposerInput', () => {
it('should strip tab-completed mentions so that only the display name is sent in the plain body in Markdown mode', () => {
// Sending a HTML message because we have entities in the composer (because of completions)
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(false);
mci.setDisplayedCompletion({
completion: 'Some Member',
@ -246,7 +242,7 @@ xdescribe('MessageComposerInput', () => {
href: `https://matrix.to/#/@some_member:domain.bla`,
});
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.args[0][1].body).toEqual(
'Some Member',
@ -260,7 +256,7 @@ xdescribe('MessageComposerInput', () => {
it('should strip tab-completed mentions so that only the display name is sent in the plain body in RTE mode', () => {
// Sending a HTML message because we have entities in the composer (because of completions)
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
mci.enableRichtext(true);
mci.setDisplayedCompletion({
completion: 'Some Member',
@ -268,7 +264,7 @@ xdescribe('MessageComposerInput', () => {
href: `https://matrix.to/#/@some_member:domain.bla`,
});
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.args[0][1].body).toEqual('Some Member');
expect(spy.args[0][1].formatted_body).toEqual('<a href="https://matrix.to/#/@some_member:domain.bla">Some Member</a>');
@ -276,12 +272,12 @@ xdescribe('MessageComposerInput', () => {
it('should not strip non-tab-completed mentions when manually typing MD', () => {
// Sending a HTML message because we have entities in the composer (because of completions)
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
// Markdown mode enabled
mci.enableRichtext(false);
addTextToDraft('[My Not-Tab-Completed Mention](https://matrix.to/#/@some_member:domain.bla)');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.args[0][1].body).toEqual('[My Not-Tab-Completed Mention](https://matrix.to/#/@some_member:domain.bla)');
expect(spy.args[0][1].formatted_body).toEqual('<a href="https://matrix.to/#/@some_member:domain.bla">My Not-Tab-Completed Mention</a>');
@ -289,12 +285,12 @@ xdescribe('MessageComposerInput', () => {
it('should not strip arbitrary typed (i.e. not tab-completed) MD links', () => {
// Sending a HTML message because we have entities in the composer (because of completions)
const spy = sinon.spy(client, 'sendMessage');
const spy = jest.spyOn(client, 'sendMessage');
// Markdown mode enabled
mci.enableRichtext(false);
addTextToDraft('[Click here](https://some.lovely.url)');
mci.handleReturn(sinon.stub());
mci.handleReturn(jest.fn());
expect(spy.args[0][1].body).toEqual('[Click here](https://some.lovely.url)');
expect(spy.args[0][1].formatted_body).toEqual('<a href="https://some.lovely.url">Click here</a>');

View file

@ -1,10 +1,9 @@
import React from 'react';
import ReactTestUtils from 'react-dom/test-utils';
import ReactDOM from 'react-dom';
import expect from 'expect';
import lolex from 'lolex';
import * as TestUtils from 'test-utils';
import * as TestUtils from '../../../test-utils';
import sdk from '../../../../src/index';
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
@ -31,7 +30,6 @@ describe('RoomList', () => {
}
let parentDiv = null;
let sandbox = null;
let client = null;
let root = null;
const myUserId = '@me:domain';
@ -45,7 +43,7 @@ describe('RoomList', () => {
let myOtherMember;
beforeEach(function() {
sandbox = TestUtils.stubClient(sandbox);
TestUtils.stubClient();
client = MatrixClientPeg.get();
client.credentials = {userId: myUserId};
//revert this to prototype method as the test-utils monkey-patches this to return a hardcoded value
@ -111,7 +109,6 @@ describe('RoomList', () => {
parentDiv.remove();
parentDiv = null;
}
sandbox.restore();
clock.uninstall();

View file

@ -1,190 +1,187 @@
// TODO: Rewrite room settings tests for dialog support
// import React from 'react';
// import ReactDOM from 'react-dom';
// import expect from 'expect';
// import jest from 'jest-mock';
// import * as testUtils from '../../../test-utils';
// import sdk from 'matrix-react-sdk';
// const WrappedRoomSettings = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.rooms.RoomSettings'));
// import MatrixClientPeg from '../../../../src/MatrixClientPeg';
// import SettingsStore from '../../../../src/settings/SettingsStore';
//
//
// describe('RoomSettings', () => {
// let parentDiv = null;
// let sandbox = null;
// let client = null;
// let roomSettings = null;
// const room = testUtils.mkStubRoom('!DdJkzRliezrwpNebLk:matrix.org');
//
// function expectSentStateEvent(roomId, eventType, expectedEventContent) {
// let found = false;
// for (const call of client.sendStateEvent.mock.calls) {
// const [
// actualRoomId,
// actualEventType,
// actualEventContent,
// ] = call.slice(0, 3);
//
// if (roomId === actualRoomId && actualEventType === eventType) {
// expect(actualEventContent).toEqual(expectedEventContent);
// found = true;
// break;
// }
// }
// expect(found).toBe(true);
// }
//
// beforeEach(function(done) {
// sandbox = testUtils.stubClient();
// client = MatrixClientPeg.get();
// client.credentials = {userId: '@me:domain.com'};
//
// client.setRoomName = jest.fn().mockReturnValue(Promise.resolve());
// client.setRoomTopic = jest.fn().mockReturnValue(Promise.resolve());
// client.setRoomDirectoryVisibility = jest.fn().mockReturnValue(Promise.resolve());
//
// // Covers any room state event (e.g. name, avatar, topic)
// client.sendStateEvent = jest.fn().mockReturnValue(Promise.resolve());
//
// // Covers room tagging
// client.setRoomTag = jest.fn().mockReturnValue(Promise.resolve());
// client.deleteRoomTag = jest.fn().mockReturnValue(Promise.resolve());
//
// // Covers any setting in the SettingsStore
// // (including local client settings not stored via matrix)
// SettingsStore.setValue = jest.fn().mockReturnValue(Promise.resolve());
//
// parentDiv = document.createElement('div');
// document.body.appendChild(parentDiv);
//
// const gatherWrappedRef = (r) => {roomSettings = r;};
//
// // get use wrappedRef because we're using wrapInMatrixClientContext
// ReactDOM.render(
// <WrappedRoomSettings
// wrappedRef={gatherWrappedRef}
// room={room}
// />,
// parentDiv,
// done,
// );
// });
//
// afterEach((done) => {
// if (parentDiv) {
// ReactDOM.unmountComponentAtNode(parentDiv);
// parentDiv.remove();
// parentDiv = null;
// }
// sandbox.restore();
// done();
// });
//
// it('should not set when no setting is changed', (done) => {
// roomSettings.save().then(() => {
// expect(client.sendStateEvent).not.toHaveBeenCalled();
// expect(client.setRoomTag).not.toHaveBeenCalled();
// expect(client.deleteRoomTag).not.toHaveBeenCalled();
// done();
// });
// });
//
// // XXX: Apparently we do call SettingsStore.setValue
// xit('should not settings via the SettingsStore when no setting is changed', (done) => {
// roomSettings.save().then(() => {
// expect(SettingsStore.setValue).not.toHaveBeenCalled();
// done();
// });
// });
//
// it('should set room name when it has changed', (done) => {
// const name = "My Room Name";
// roomSettings.setName(name);
//
// roomSettings.save().then(() => {
// expect(client.setRoomName.mock.calls[0].slice(0, 2))
// .toEqual(['!DdJkzRliezrwpNebLk:matrix.org', name]);
//
// done();
// });
// });
//
// it('should set room topic when it has changed', (done) => {
// const topic = "this is a topic";
// roomSettings.setTopic(topic);
//
// roomSettings.save().then(() => {
// expect(client.setRoomTopic.mock.calls[0].slice(0, 2))
// .toEqual(['!DdJkzRliezrwpNebLk:matrix.org', topic]);
//
// done();
// });
// });
//
// it('should set history visibility when it has changed', (done) => {
// const historyVisibility = "translucent";
// roomSettings.setState({
// history_visibility: historyVisibility,
// });
//
// roomSettings.save().then(() => {
// expectSentStateEvent(
// "!DdJkzRliezrwpNebLk:matrix.org",
// "m.room.history_visibility", {history_visibility: historyVisibility},
// );
// done();
// });
// });
//
// // XXX: Can't test this because we `getRoomDirectoryVisibility` in `componentWillMount`
// xit('should set room directory publicity when set to true', (done) => {
// const isRoomPublished = true;
// roomSettings.setState({
// isRoomPublished,
// }, () => {
// roomSettings.save().then(() => {
// expect(client.setRoomDirectoryVisibility.calls[0].arguments.slice(0, 2))
// .toEqual("!DdJkzRliezrwpNebLk:matrix.org", isRoomPublished ? "public" : "private");
// done();
// });
// });
// });
//
// it('should set power levels when changed', (done) => {
// roomSettings.onPowerLevelsChanged(42, "invite");
//
// roomSettings.save().then(() => {
// expectSentStateEvent(
// "!DdJkzRliezrwpNebLk:matrix.org",
// "m.room.power_levels", { invite: 42 },
// );
// done();
// });
// });
//
// it('should set event power levels when changed', (done) => {
// roomSettings.onPowerLevelsChanged(42, "event_levels_m.room.message");
//
// roomSettings.save().then(() => {
// // We expect all state events to be set to the state_default (50)
// // See powerLevelDescriptors in RoomSettings
// expectSentStateEvent(
// "!DdJkzRliezrwpNebLk:matrix.org",
// "m.room.power_levels", {
// events: {
// 'm.room.message': 42,
// 'm.room.avatar': 50,
// 'm.room.name': 50,
// 'm.room.canonical_alias': 50,
// 'm.room.history_visibility': 50,
// 'm.room.power_levels': 50,
// 'm.room.topic': 50,
// 'im.vector.modular.widgets': 50,
// },
// },
// );
// done();
// });
// });
// });
import React from 'react';
import ReactDOM from 'react-dom';
import jest from 'jest-mock';
import * as testUtils from '../../../test-utils';
import sdk from '../../../skinned-sdk';
const WrappedRoomSettings = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.rooms.RoomSettings'));
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
import SettingsStore from '../../../../src/settings/SettingsStore';
describe.skip('RoomSettings', () => {
let parentDiv = null;
let client = null;
let roomSettings = null;
const room = testUtils.mkStubRoom('!DdJkzRliezrwpNebLk:matrix.org');
function expectSentStateEvent(roomId, eventType, expectedEventContent) {
let found = false;
for (const call of client.sendStateEvent.mock.calls) {
const [
actualRoomId,
actualEventType,
actualEventContent,
] = call.slice(0, 3);
if (roomId === actualRoomId && actualEventType === eventType) {
expect(actualEventContent).toEqual(expectedEventContent);
found = true;
break;
}
}
expect(found).toBe(true);
}
beforeEach(function(done) {
testUtils.stubClient();
client = MatrixClientPeg.get();
client.credentials = {userId: '@me:domain.com'};
client.setRoomName = jest.fn().mockReturnValue(Promise.resolve());
client.setRoomTopic = jest.fn().mockReturnValue(Promise.resolve());
client.setRoomDirectoryVisibility = jest.fn().mockReturnValue(Promise.resolve());
// Covers any room state event (e.g. name, avatar, topic)
client.sendStateEvent = jest.fn().mockReturnValue(Promise.resolve());
// Covers room tagging
client.setRoomTag = jest.fn().mockReturnValue(Promise.resolve());
client.deleteRoomTag = jest.fn().mockReturnValue(Promise.resolve());
// Covers any setting in the SettingsStore
// (including local client settings not stored via matrix)
SettingsStore.setValue = jest.fn().mockReturnValue(Promise.resolve());
parentDiv = document.createElement('div');
document.body.appendChild(parentDiv);
const gatherWrappedRef = (r) => {roomSettings = r;};
// get use wrappedRef because we're using wrapInMatrixClientContext
ReactDOM.render(
<WrappedRoomSettings
wrappedRef={gatherWrappedRef}
room={room}
/>,
parentDiv,
done,
);
});
afterEach((done) => {
if (parentDiv) {
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
parentDiv = null;
}
done();
});
it('should not set when no setting is changed', (done) => {
roomSettings.save().then(() => {
expect(client.sendStateEvent).not.toHaveBeenCalled();
expect(client.setRoomTag).not.toHaveBeenCalled();
expect(client.deleteRoomTag).not.toHaveBeenCalled();
done();
});
});
// XXX: Apparently we do call SettingsStore.setValue
xit('should not settings via the SettingsStore when no setting is changed', (done) => {
roomSettings.save().then(() => {
expect(SettingsStore.setValue).not.toHaveBeenCalled();
done();
});
});
it('should set room name when it has changed', (done) => {
const name = "My Room Name";
roomSettings.setName(name);
roomSettings.save().then(() => {
expect(client.setRoomName.mock.calls[0].slice(0, 2))
.toEqual(['!DdJkzRliezrwpNebLk:matrix.org', name]);
done();
});
});
it('should set room topic when it has changed', (done) => {
const topic = "this is a topic";
roomSettings.setTopic(topic);
roomSettings.save().then(() => {
expect(client.setRoomTopic.mock.calls[0].slice(0, 2))
.toEqual(['!DdJkzRliezrwpNebLk:matrix.org', topic]);
done();
});
});
it('should set history visibility when it has changed', (done) => {
const historyVisibility = "translucent";
roomSettings.setState({
history_visibility: historyVisibility,
});
roomSettings.save().then(() => {
expectSentStateEvent(
"!DdJkzRliezrwpNebLk:matrix.org",
"m.room.history_visibility", {history_visibility: historyVisibility},
);
done();
});
});
// XXX: Can't test this because we `getRoomDirectoryVisibility` in `componentWillMount`
xit('should set room directory publicity when set to true', (done) => {
const isRoomPublished = true;
roomSettings.setState({
isRoomPublished,
}, () => {
roomSettings.save().then(() => {
expect(client.setRoomDirectoryVisibility.calls[0].arguments.slice(0, 2))
.toEqual("!DdJkzRliezrwpNebLk:matrix.org", isRoomPublished ? "public" : "private");
done();
});
});
});
it('should set power levels when changed', (done) => {
roomSettings.onPowerLevelsChanged(42, "invite");
roomSettings.save().then(() => {
expectSentStateEvent(
"!DdJkzRliezrwpNebLk:matrix.org",
"m.room.power_levels", { invite: 42 },
);
done();
});
});
it('should set event power levels when changed', (done) => {
roomSettings.onPowerLevelsChanged(42, "event_levels_m.room.message");
roomSettings.save().then(() => {
// We expect all state events to be set to the state_default (50)
// See powerLevelDescriptors in RoomSettings
expectSentStateEvent(
"!DdJkzRliezrwpNebLk:matrix.org",
"m.room.power_levels", {
events: {
'm.room.message': 42,
'm.room.avatar': 50,
'm.room.name': 50,
'm.room.canonical_alias': 50,
'm.room.history_visibility': 50,
'm.room.power_levels': 50,
'm.room.topic': 50,
'im.vector.modular.widgets': 50,
},
},
);
done();
});
});
});

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import {getLineAndNodePosition} from "../../src/editor/caret";
import EditorModel from "../../src/editor/model";
import {createPartCreator} from "./mock";

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import {parseEvent} from "../../src/editor/deserialize";
import {createPartCreator} from "./mock";

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import {diffDeletion, diffAtCaret} from "../../src/editor/diff";
describe('editor/diff', function() {

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import HistoryManager, {MAX_STEP_LENGTH} from "../../src/editor/history";
describe('editor/history', function() {

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import EditorModel from "../../src/editor/model";
import {createPartCreator} from "./mock";

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import EditorModel from "../../src/editor/model";
import {createPartCreator} from "./mock";

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import EditorModel from "../../src/editor/model";
import {createPartCreator} from "./mock";

View file

@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import EditorModel from "../../src/editor/model";
import {htmlSerializeIfNeeded} from "../../src/editor/serialize";
import {createPartCreator} from "./mock";

View file

@ -5,18 +5,12 @@ import * as languageHandler from '../../src/languageHandler';
const testUtils = require('../test-utils');
describe('languageHandler', function() {
let sandbox;
beforeEach(function(done) {
sandbox = testUtils.stubClient();
testUtils.stubClient();
languageHandler.setLanguage('en').then(done);
});
afterEach(function() {
sandbox.restore();
});
it('translates a string to german', function() {
languageHandler.setLanguage('de').then(function() {
const translated = languageHandler._t('Rooms');

View file

@ -1,8 +1,5 @@
import expect from 'expect';
import RoomViewStore from '../../src/stores/RoomViewStore';
import peg from '../../src/MatrixClientPeg';
import * as testUtils from '../test-utils';
@ -10,20 +7,14 @@ import * as testUtils from '../test-utils';
const dispatch = testUtils.getDispatchForStore(RoomViewStore);
describe('RoomViewStore', function() {
let sandbox;
beforeEach(function() {
sandbox = testUtils.stubClient();
testUtils.stubClient();
peg.get().credentials = { userId: "@test:example.com" };
// Reset the state of the store
RoomViewStore.reset();
});
afterEach(function() {
sandbox.restore();
});
it('can be used to view a room by ID and join', function(done) {
peg.get().joinRoom = (roomAddress) => {
expect(roomAddress).toBe("!randomcharacters:aser.ver");

View file

@ -1,6 +1,5 @@
"use strict";
import sinon from 'sinon';
import React from 'react';
import PropTypes from 'prop-types';
import peg from '../src/MatrixClientPeg';
@ -27,8 +26,6 @@ export function getRenderer() {
* @returns {sinon.Sandbox}; remember to call sandbox.restore afterwards.
*/
export function stubClient() {
const sandbox = sinon.sandbox.create();
const client = createTestClient();
// stub out the methods in MatrixClientPeg
@ -37,12 +34,11 @@ export function stubClient() {
// so we do this for each method
const methods = ['get', 'unset', 'replaceUsingCreds'];
for (let i = 0; i < methods.length; i++) {
sandbox.stub(peg, methods[i]);
peg[methods[i]] = jest.spyOn(peg, methods[i]);
}
// MatrixClientPeg.get() is called a /lot/, so implement it with our own
// fast stub function rather than a sinon stub
peg.get = function() { return client; };
return sandbox;
}
/**
@ -52,27 +48,27 @@ export function stubClient() {
*/
export function createTestClient() {
return {
getHomeserverUrl: sinon.stub(),
getIdentityServerUrl: sinon.stub(),
getDomain: sinon.stub().returns("matrix.rog"),
getUserId: sinon.stub().returns("@userId:matrix.rog"),
getHomeserverUrl: jest.fn(),
getIdentityServerUrl: jest.fn(),
getDomain: jest.fn().mockReturnValue("matrix.rog"),
getUserId: jest.fn().mockReturnValue("@userId:matrix.rog"),
getPushActionsForEvent: sinon.stub(),
getRoom: sinon.stub().returns(mkStubRoom()),
getRooms: sinon.stub().returns([]),
getVisibleRooms: sinon.stub().returns([]),
getGroups: sinon.stub().returns([]),
loginFlows: sinon.stub(),
on: sinon.stub(),
removeListener: sinon.stub(),
isRoomEncrypted: sinon.stub().returns(false),
peekInRoom: sinon.stub().returns(Promise.resolve(mkStubRoom())),
getPushActionsForEvent: jest.fn(),
getRoom: jest.fn().mockReturnValue(mkStubRoom()),
getRooms: jest.fn().mockReturnValue([]),
getVisibleRooms: jest.fn().mockReturnValue([]),
getGroups: jest.fn().mockReturnValue([]),
loginFlows: jest.fn(),
on: jest.fn(),
removeListener: jest.fn(),
isRoomEncrypted: jest.fn().mockReturnValue(false),
peekInRoom: jest.fn().mockResolvedValue(mkStubRoom()),
paginateEventTimeline: sinon.stub().returns(Promise.resolve()),
sendReadReceipt: sinon.stub().returns(Promise.resolve()),
getRoomIdForAlias: sinon.stub().returns(Promise.resolve()),
getRoomDirectoryVisibility: sinon.stub().returns(Promise.resolve()),
getProfileInfo: sinon.stub().returns(Promise.resolve({})),
paginateEventTimeline: jest.fn().mockResolvedValue(undefined),
sendReadReceipt: jest.fn().mockResolvedValue(undefined),
getRoomIdForAlias: jest.fn().mockResolvedValue(undefined),
getRoomDirectoryVisibility: jest.fn().mockResolvedValue(undefined),
getProfileInfo: jest.fn().mockResolvedValue({}),
getAccountData: (type) => {
return mkEvent({
type,
@ -81,9 +77,9 @@ export function createTestClient() {
});
},
mxcUrlToHttp: (mxc) => 'http://this.is.a.url/',
setAccountData: sinon.stub(),
sendTyping: sinon.stub().returns(Promise.resolve({})),
sendMessage: () => Promise.resolve({}),
setAccountData: jest.fn(),
sendTyping: jest.fn().mockResolvedValue({}),
sendMessage: () => jest.fn().mockResolvedValue({}),
getSyncState: () => "SYNCING",
generateClientSecret: () => "t35tcl1Ent5ECr3T",
isGuest: () => false,
@ -214,15 +210,15 @@ export function mkStubRoom(roomId = null) {
const stubTimeline = { getEvents: () => [] };
return {
roomId,
getReceiptsForEvent: sinon.stub().returns([]),
getMember: sinon.stub().returns({
getReceiptsForEvent: jest.fn().mockReturnValue([]),
getMember: jest.fn().mockReturnValue({
userId: '@member:domain.bla',
name: 'Member',
roomId: roomId,
getAvatarUrl: () => 'mxc://avatar.url/image.png',
}),
getMembersWithMembership: sinon.stub().returns([]),
getJoinedMembers: sinon.stub().returns([]),
getMembersWithMembership: jest.fn().mockReturnValue([]),
getJoinedMembers: jest.fn().mockReturnValue([]),
getPendingEvents: () => [],
getLiveTimeline: () => stubTimeline,
getUnfilteredTimelineSet: () => null,
@ -231,12 +227,12 @@ export function mkStubRoom(roomId = null) {
getVersion: () => '1',
shouldUpgradeToVersion: () => null,
getMyMembership: () => "join",
maySendMessage: sinon.stub().returns(true),
maySendMessage: jest.fn().mockReturnValue(true),
currentState: {
getStateEvents: sinon.stub(),
mayClientSendStateEvent: sinon.stub().returns(true),
maySendStateEvent: sinon.stub().returns(true),
maySendEvent: sinon.stub().returns(true),
getStateEvents: jest.fn(),
mayClientSendStateEvent: jest.fn().mockReturnValue(true),
maySendStateEvent: jest.fn().mockReturnValue(true),
maySendEvent: jest.fn().mockReturnValue(true),
members: [],
},
tags: {
@ -244,9 +240,9 @@ export function mkStubRoom(roomId = null) {
order: 0.5,
},
},
setBlacklistUnverifiedDevices: sinon.stub(),
on: sinon.stub(),
removeListener: sinon.stub(),
setBlacklistUnverifiedDevices: jest.fn(),
on: jest.fn(),
removeListener: jest.fn(),
};
}
@ -295,7 +291,7 @@ export function wrapInMatrixClientContext(WrappedComponent) {
/**
* Call fn before calling componentDidUpdate on a react component instance, inst.
* @param {React.Component} inst an instance of a React component.
* @param {integer} updates Number of updates to wait for. (Defaults to 1.)
* @param {number} updates Number of updates to wait for. (Defaults to 1.)
* @returns {Promise} promise that resolves when componentDidUpdate is called on
* given component instance.
*/

View file

@ -16,9 +16,7 @@ limitations under the License.
"use strict";
import * as MegolmExportEncryption from '../../src/utils/MegolmExportEncryption';
import expect from 'expect';
import SubtleCrypto from 'subtle';
const TEST_VECTORS=[
[
@ -58,19 +56,22 @@ const TEST_VECTORS=[
"bWnSXS9oymiqwUIGs08sXI33ZA==\n" +
"-----END MEGOLM SESSION DATA-----",
],
]
;
];
function stringToArray(s) {
return new TextEncoder().encode(s).buffer;
}
describe('MegolmExportEncryption', function() {
before(function() {
// if we don't have subtlecrypto, go home now
if (!window.crypto.subtle && !window.crypto.webkitSubtle) {
this.skip();
}
let MegolmExportEncryption;
beforeAll(() => {
window.crypto = { subtle: SubtleCrypto };
MegolmExportEncryption = require("../../src/utils/MegolmExportEncryption");
});
afterAll(() => {
window.crypto = undefined;
});
describe('decrypt', function() {

View file

@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import peg from '../../../src/MatrixClientPeg';
import {
makeGroupPermalink,
@ -66,17 +65,11 @@ function mockRoom(roomId, members, serverACL) {
}
describe('Permalinks', function() {
let sandbox;
beforeEach(function() {
sandbox = testUtils.stubClient();
testUtils.stubClient();
peg.get().credentials = { userId: "@test:example.com" };
});
afterEach(function() {
sandbox.restore();
});
it('should pick no candidate servers when the room has no members', function() {
const room = mockRoom("!fake:example.org", []);
const creator = new RoomPermalinkCreator(room);

312
yarn.lock
View file

@ -125,42 +125,6 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"
"@jest/console@^24.9.0":
version "24.9.0"
resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0"
integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==
dependencies:
"@jest/source-map" "^24.9.0"
chalk "^2.0.1"
slash "^2.0.0"
"@jest/source-map@^24.9.0":
version "24.9.0"
resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714"
integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==
dependencies:
callsites "^3.0.0"
graceful-fs "^4.1.15"
source-map "^0.6.0"
"@jest/test-result@^24.9.0":
version "24.9.0"
resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca"
integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==
dependencies:
"@jest/console" "^24.9.0"
"@jest/types" "^24.9.0"
"@types/istanbul-lib-coverage" "^2.0.0"
"@jest/types@^24.9.0":
version "24.9.0"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59"
integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^13.0.0"
"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
@ -174,42 +138,6 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
"@sinonjs/commons@^1", "@sinonjs/commons@^1.3.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.6.0.tgz#ec7670432ae9c8eb710400d112c201a362d83393"
integrity sha512-w4/WHG7C4WWFyE5geCieFJF6MZkbW4VAriol5KlmQXpAQdxvV0p26sqNZOW6Qyw6Y0l9K4g+cHvvczR2sEEpqg==
dependencies:
type-detect "4.0.8"
"@sinonjs/formatio@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@sinonjs/formatio/-/formatio-2.0.0.tgz#84db7e9eb5531df18a8c5e0bfb6e449e55e654b2"
integrity sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==
dependencies:
samsam "1.3.0"
"@sinonjs/formatio@^3.2.1":
version "3.2.2"
resolved "https://registry.yarnpkg.com/@sinonjs/formatio/-/formatio-3.2.2.tgz#771c60dfa75ea7f2d68e3b94c7e888a78781372c"
integrity sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==
dependencies:
"@sinonjs/commons" "^1"
"@sinonjs/samsam" "^3.1.0"
"@sinonjs/samsam@^3.1.0":
version "3.3.3"
resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-3.3.3.tgz#46682efd9967b259b81136b9f120fd54585feb4a"
integrity sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==
dependencies:
"@sinonjs/commons" "^1.3.0"
array-from "^2.1.1"
lodash "^4.17.15"
"@sinonjs/text-encoding@^0.7.1":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz#8da5c6530915653f3a1f38fd5f101d8c3f8079c5"
integrity sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==
"@types/events@*":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
@ -224,26 +152,6 @@
"@types/minimatch" "*"
"@types/node" "*"
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==
"@types/istanbul-lib-report@*":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c"
integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==
dependencies:
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-reports@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a"
integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==
dependencies:
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"
"@types/json-schema@^7.0.3":
version "7.0.3"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
@ -259,11 +167,6 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.14.tgz#1c1d6e3c75dba466e0326948d56e8bd72a1903d2"
integrity sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==
"@types/stack-utils@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==
"@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"
@ -285,18 +188,6 @@
"@types/unist" "*"
"@types/vfile-message" "*"
"@types/yargs-parser@*":
version "13.1.0"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228"
integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==
"@types/yargs@^13.0.0":
version "13.0.3"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380"
integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ==
dependencies:
"@types/yargs-parser" "*"
"@typescript-eslint/experimental-utils@^2.5.0":
version "2.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.10.0.tgz#8db1656cdfd3d9dcbdbf360b8274dea76f0b2c2c"
@ -592,7 +483,7 @@ ansi-regex@^3.0.0:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=
ansi-regex@^4.0.0, ansi-regex@^4.1.0:
ansi-regex@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==
@ -692,11 +583,6 @@ array-find-index@^1.0.1:
resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1"
integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=
array-from@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/array-from/-/array-from-2.1.1.tgz#cfe9d8c26628b9dc5aecc62a9f5d8f1f352c1195"
integrity sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=
array-includes@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d"
@ -1649,6 +1535,11 @@ blob@0.0.5:
resolved "https://registry.yarnpkg.com/blob/-/blob-0.0.5.tgz#d680eeef25f8cd91ad533f5b01eed48e64caf683"
integrity sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==
bluebird@^2.9.27:
version "2.11.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
integrity sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=
bluebird@^3.3.0, bluebird@^3.5.0, bluebird@^3.5.5:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
@ -2689,12 +2580,7 @@ diff-match-patch@^1.0.4:
resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.4.tgz#6ac4b55237463761c4daf0dc603eb869124744b1"
integrity sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg==
diff-sequences@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5"
integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==
diff@3.5.0, diff@^3.2.0, diff@^3.5.0:
diff@3.5.0, diff@^3.2.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==
@ -2813,6 +2699,13 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"
ecc-jsbn@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.0.1.tgz#970577ba31b4976fb1889a298cb7451d896c466d"
integrity sha1-lwV3ujG0l2+xiJopjLdFHYlsRm0=
dependencies:
jsbn "git+https://github.com/rynomad/jsbn.git"
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
@ -2821,6 +2714,12 @@ ecc-jsbn@~0.1.1:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
"ecc-qj@git+https://github.com/rynomad/ecc.git":
version "0.0.1"
resolved "git+https://github.com/rynomad/ecc.git#a8c599363dab87a5c95274338d863233f00f7c4a"
dependencies:
nan "^1.6.2"
ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
@ -3370,18 +3269,6 @@ expect@^23.6.0:
jest-message-util "^23.4.0"
jest-regex-util "^23.3.0"
expect@^24.1.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca"
integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==
dependencies:
"@jest/types" "^24.9.0"
ansi-styles "^3.2.0"
jest-get-type "^24.9.0"
jest-matcher-utils "^24.9.0"
jest-message-util "^24.9.0"
jest-regex-util "^24.9.0"
extend-shallow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@ -4947,11 +4834,6 @@ is-wsl@^1.1.0:
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@ -5158,16 +5040,6 @@ jest-diff@^23.6.0:
jest-get-type "^22.1.0"
pretty-format "^23.6.0"
jest-diff@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da"
integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==
dependencies:
chalk "^2.0.1"
diff-sequences "^24.9.0"
jest-get-type "^24.9.0"
pretty-format "^24.9.0"
jest-docblock@^23.2.0:
version "23.2.0"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-23.2.0.tgz#f085e1f18548d99fdd69b20207e6fd55d91383a7"
@ -5205,11 +5077,6 @@ jest-get-type@^22.1.0:
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4"
integrity sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==
jest-get-type@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e"
integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==
jest-haste-map@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.6.0.tgz#2e3eb997814ca696d62afdb3f2529f5bbc935e16"
@ -5258,16 +5125,6 @@ jest-matcher-utils@^23.6.0:
jest-get-type "^22.1.0"
pretty-format "^23.6.0"
jest-matcher-utils@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073"
integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==
dependencies:
chalk "^2.0.1"
jest-diff "^24.9.0"
jest-get-type "^24.9.0"
pretty-format "^24.9.0"
jest-message-util@^23.4.0:
version "23.4.0"
resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-23.4.0.tgz#17610c50942349508d01a3d1e0bda2c079086a9f"
@ -5279,20 +5136,6 @@ jest-message-util@^23.4.0:
slash "^1.0.0"
stack-utils "^1.0.1"
jest-message-util@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3"
integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==
dependencies:
"@babel/code-frame" "^7.0.0"
"@jest/test-result" "^24.9.0"
"@jest/types" "^24.9.0"
"@types/stack-utils" "^1.0.1"
chalk "^2.0.1"
micromatch "^3.1.10"
slash "^2.0.0"
stack-utils "^1.0.1"
jest-mock@^23.2.0:
version "23.2.0"
resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-23.2.0.tgz#ad1c60f29e8719d47c26e1138098b6d18b261134"
@ -5303,11 +5146,6 @@ jest-regex-util@^23.3.0:
resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-23.3.0.tgz#5f86729547c2785c4002ceaa8f849fe8ca471bc5"
integrity sha1-X4ZylUfCeFxAAs6qj4Sf6MpHG8U=
jest-regex-util@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636"
integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==
jest-resolve-dependencies@^23.6.0:
version "23.6.0"
resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.6.0.tgz#b4526af24c8540d9a3fab102c15081cf509b723d"
@ -5471,6 +5309,10 @@ js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.7.0:
argparse "^1.0.7"
esprima "^4.0.0"
"jsbn@git+https://github.com/rynomad/jsbn.git":
version "0.0.0"
resolved "git+https://github.com/rynomad/jsbn.git#bb522b0124f75424f89d49446c40a87111942c7b"
jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
@ -5592,11 +5434,6 @@ jsx-ast-utils@^2.2.3:
array-includes "^3.0.3"
object.assign "^4.1.0"
just-extend@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.0.2.tgz#f3f47f7dfca0f989c55410a7ebc8854b07108afc"
integrity sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==
karma-chrome-launcher@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz#cf1b9d07136cc18fe239327d24654c3dbc368acf"
@ -5830,11 +5667,6 @@ lodash.escaperegexp@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347"
integrity sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=
lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
lodash.isboolean@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6"
@ -5898,16 +5730,11 @@ loglevel@^1.6.4:
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.6.tgz#0ee6300cc058db6b3551fa1c4bf73b83bb771312"
integrity sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ==
lolex@4.2, lolex@^4.1.0:
lolex@4.2:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-4.2.0.tgz#ddbd7f6213ca1ea5826901ab1222b65d714b3cd7"
integrity sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==
lolex@^2.4.2:
version "2.7.5"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.7.5.tgz#113001d56bfc7e02d56e36291cc5c413d1aa0733"
integrity sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==
longest-streak@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.3.tgz#3de7a3f47ee18e9074ded8575b5c091f5d0a4105"
@ -6368,6 +6195,11 @@ mute-stream@0.0.7:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=
nan@^1.6.2:
version "1.9.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-1.9.0.tgz#1a9cd2755609766f5c291e4194fce39fde286515"
integrity sha1-GpzSdVYJdm9cKR5BlPzjn94oZRU=
nan@^2.12.1:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
@ -6419,17 +6251,6 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
nise@^1.3.3:
version "1.5.2"
resolved "https://registry.yarnpkg.com/nise/-/nise-1.5.2.tgz#b6d29af10e48b321b307e10e065199338eeb2652"
integrity sha512-/6RhOUlicRCbE9s+94qCUsyE+pKlVJ5AhIv+jEE7ESKwnbXqulKZ1FYU+XAtHHWE9TinYvAxDUJAb912PwPoWA==
dependencies:
"@sinonjs/formatio" "^3.2.1"
"@sinonjs/text-encoding" "^0.7.1"
just-extend "^4.0.2"
lolex "^4.1.0"
path-to-regexp "^1.7.0"
node-fetch-npm@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7"
@ -6447,6 +6268,11 @@ node-fetch@^1.0.1:
encoding "^0.1.11"
is-stream "^1.0.1"
node-forge@^0.6.20:
version "0.6.49"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.6.49.tgz#f1ee95d5d74623938fe19d698aa5a26d54d2f60f"
integrity sha1-8e6V1ddGI5OP4Z1piqWibVTS9g8=
node-int64@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b"
@ -7002,13 +6828,6 @@ path-parse@^1.0.5, path-parse@^1.0.6:
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
path-to-regexp@^1.7.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a"
integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==
dependencies:
isarray "0.0.1"
path-type@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441"
@ -7109,6 +6928,13 @@ png-chunks-extract@^1.0.0:
dependencies:
crc-32 "^0.3.0"
polyfill-promise@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/polyfill-promise/-/polyfill-promise-4.0.1.tgz#f8448dc27c3b967d5f67fc060f56ed64e2286b49"
integrity sha1-+ESNwnw7ln1fZ/wGD1btZOIoa0k=
dependencies:
bluebird "^2.9.27"
posix-character-classes@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
@ -7245,16 +7071,6 @@ pretty-format@^23.6.0:
ansi-regex "^3.0.0"
ansi-styles "^3.2.0"
pretty-format@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9"
integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==
dependencies:
"@jest/types" "^24.9.0"
ansi-regex "^4.0.0"
ansi-styles "^3.2.0"
react-is "^16.8.4"
private@^0.1.6, private@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
@ -7536,7 +7352,7 @@ react-immutable-proptypes@^2.1.0:
resolved "https://registry.yarnpkg.com/react-immutable-proptypes/-/react-immutable-proptypes-2.1.0.tgz#023d6f39bb15c97c071e9e60d00d136eac5fa0b4"
integrity sha1-Aj1vObsVyXwHHp5g0A0TbqxfoLQ=
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.6:
version "16.12.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==
@ -8094,11 +7910,6 @@ safe-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
samsam@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50"
integrity sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==
sane@^2.0.0:
version "2.5.2"
resolved "https://registry.yarnpkg.com/sane/-/sane-2.5.2.tgz#b4dc1861c21b427e929507a3e751e2a2cb8ab3fa"
@ -8235,24 +8046,16 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
sinon@^5.0.7:
version "5.1.1"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-5.1.1.tgz#19c59810ffb733ea6e76a28b94a71fc4c2f523b8"
integrity sha512-h/3uHscbt5pQNxkf7Y/Lb9/OM44YNCicHakcq73ncbrIS8lXg+ZGOZbtuU+/km4YnyiCYfQQEwANaReJz7KDfw==
dependencies:
"@sinonjs/formatio" "^2.0.0"
diff "^3.5.0"
lodash.get "^4.4.2"
lolex "^2.4.2"
nise "^1.3.3"
supports-color "^5.4.0"
type-detect "^4.0.8"
sisteransi@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-0.1.1.tgz#5431447d5f7d1675aac667ccd0b865a4994cb3ce"
integrity sha512-PmGOd02bM9YO5ifxpw36nrNMBTptEtfRl4qUYl9SndkolplkrZZOW7PGHjrZL53QvMVj9nQ+TKqUnRsw4tJa4g==
sjcl@^1.0.3:
version "1.0.8"
resolved "https://registry.yarnpkg.com/sjcl/-/sjcl-1.0.8.tgz#f2ec8d7dc1f0f21b069b8914a41a8f236b0e252a"
integrity sha512-LzIjEQ0S0DpIgnxMEayM1rq9aGwGRG4OnZhCdjx7glTaJtf4zRfpg87ImfjSJjoW9vKpagd82McDOwbRT5kQKQ==
slash@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
@ -8888,6 +8691,18 @@ stylelint@^9.10.1:
svg-tags "^1.0.0"
table "^5.0.0"
subtle@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/subtle/-/subtle-0.1.8.tgz#0c12599b9cf13127eda11626510cd8f24f878916"
integrity sha1-DBJZm5zxMSftoRYmUQzY8k+HiRY=
dependencies:
ecc-jsbn "0.0.1"
node-forge "^0.6.20"
polyfill-promise "^4.0.1"
sjcl "^1.0.3"
optionalDependencies:
ecc-qj "git+https://github.com/rynomad/ecc.git"
sugarss@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/sugarss/-/sugarss-2.0.0.tgz#ddd76e0124b297d40bf3cca31c8b22ecb43bc61d"
@ -8928,7 +8743,7 @@ supports-color@^4.5.0:
dependencies:
has-flag "^2.0.0"
supports-color@^5.3.0, supports-color@^5.4.0:
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
@ -9216,11 +9031,6 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"
type-detect@4.0.8, type-detect@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
type-is@~1.6.17:
version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"