Fix linting in tests
Or in the case of one test, disbale just the one rule it breakspull/21833/head
parent
ee9be5438e
commit
543fe6382d
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2016 OpenMarket Ltd
|
Copyright 2016 OpenMarket Ltd
|
||||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
Copyright 2019, 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -29,7 +29,7 @@ const MessagePanel = sdk.getComponent('structures.MessagePanel');
|
||||||
import { MatrixClientPeg } from '../../../src/MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../src/MatrixClientPeg';
|
||||||
import Matrix from 'matrix-js-sdk';
|
import Matrix from 'matrix-js-sdk';
|
||||||
|
|
||||||
const test_utils = require('../../test-utils');
|
const TestUtilsMatrix = require('../../test-utils');
|
||||||
const mockclock = require('../../mock-clock');
|
const mockclock = require('../../mock-clock');
|
||||||
|
|
||||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
|
@ -77,7 +77,7 @@ describe('MessagePanel', function() {
|
||||||
const events = mkEvents();
|
const events = mkEvents();
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
test_utils.stubClient();
|
TestUtilsMatrix.stubClient();
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.credentials = { userId: '@me:here' };
|
client.credentials = { userId: '@me:here' };
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ describe('MessagePanel', function() {
|
||||||
const events = [];
|
const events = [];
|
||||||
const ts0 = Date.now();
|
const ts0 = Date.now();
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
events.push(test_utils.mkMessage(
|
events.push(TestUtilsMatrix.mkMessage(
|
||||||
{
|
{
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
event: true, room: "!room:id", user: "@user:id",
|
||||||
ts: ts0 + i * 1000,
|
ts: ts0 + i * 1000,
|
||||||
|
@ -111,7 +111,7 @@ describe('MessagePanel', function() {
|
||||||
const events = [];
|
const events = [];
|
||||||
const ts0 = Date.parse('09 May 2004 00:12:00 GMT');
|
const ts0 = Date.parse('09 May 2004 00:12:00 GMT');
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
events.push(test_utils.mkMessage(
|
events.push(TestUtilsMatrix.mkMessage(
|
||||||
{
|
{
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
event: true, room: "!room:id", user: "@user:id",
|
||||||
ts: ts0 + i * 1000,
|
ts: ts0 + i * 1000,
|
||||||
|
@ -127,13 +127,13 @@ describe('MessagePanel', function() {
|
||||||
const ts0 = Date.now();
|
const ts0 = Date.now();
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
events.push(test_utils.mkMessage({
|
events.push(TestUtilsMatrix.mkMessage({
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
event: true, room: "!room:id", user: "@user:id",
|
||||||
ts: ts0 + ++i * 1000,
|
ts: ts0 + ++i * 1000,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
events.push(test_utils.mkMembership({
|
events.push(TestUtilsMatrix.mkMembership({
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
event: true, room: "!room:id", user: "@user:id",
|
||||||
target: {
|
target: {
|
||||||
userId: "@user:id",
|
userId: "@user:id",
|
||||||
|
@ -150,7 +150,7 @@ describe('MessagePanel', function() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
events.push(test_utils.mkMessage({
|
events.push(TestUtilsMatrix.mkMessage({
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
event: true, room: "!room:id", user: "@user:id",
|
||||||
ts: ts0 + ++i*1000,
|
ts: ts0 + ++i*1000,
|
||||||
}));
|
}));
|
||||||
|
@ -166,7 +166,7 @@ describe('MessagePanel', function() {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
events.push(test_utils.mkMembership({
|
events.push(TestUtilsMatrix.mkMembership({
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
event: true, room: "!room:id", user: "@user:id",
|
||||||
target: {
|
target: {
|
||||||
userId: "@user:id",
|
userId: "@user:id",
|
||||||
|
@ -188,8 +188,8 @@ describe('MessagePanel', function() {
|
||||||
|
|
||||||
// A list of room creation, encryption, and invite events.
|
// A list of room creation, encryption, and invite events.
|
||||||
function mkCreationEvents() {
|
function mkCreationEvents() {
|
||||||
const mkEvent = test_utils.mkEvent;
|
const mkEvent = TestUtilsMatrix.mkEvent;
|
||||||
const mkMembership = test_utils.mkMembership;
|
const mkMembership = TestUtilsMatrix.mkMembership;
|
||||||
const roomId = "!someroom";
|
const roomId = "!someroom";
|
||||||
const alice = "@alice:example.org";
|
const alice = "@alice:example.org";
|
||||||
const ts0 = Date.now();
|
const ts0 = Date.now();
|
||||||
|
|
|
@ -22,7 +22,7 @@ import MatrixReactTestUtils from 'matrix-react-test-utils';
|
||||||
import sdk from '../../../skinned-sdk';
|
import sdk from '../../../skinned-sdk';
|
||||||
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
||||||
|
|
||||||
import * as test_utils from '../../../test-utils';
|
import * as TestUtilsMatrix from '../../../test-utils';
|
||||||
import { sleep } from "../../../../src/utils/promise";
|
import { sleep } from "../../../../src/utils/promise";
|
||||||
|
|
||||||
const InteractiveAuthDialog = sdk.getComponent(
|
const InteractiveAuthDialog = sdk.getComponent(
|
||||||
|
@ -33,7 +33,7 @@ describe('InteractiveAuthDialog', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
test_utils.stubClient();
|
TestUtilsMatrix.stubClient();
|
||||||
parentDiv = document.createElement('div');
|
parentDiv = document.createElement('div');
|
||||||
document.body.appendChild(parentDiv);
|
document.body.appendChild(parentDiv);
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,8 +42,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
* The reason for C&Ping jasmine's clock here is that jasmine itself is
|
* The reason for C&Ping jasmine's clock here is that jasmine itself is
|
||||||
* difficult to webpack, and we don't really want all of it. Sinon also has a
|
* difficult to webpack, and we don't really want all of it. Sinon also has a
|
||||||
* mock-clock implementation, but again, it is difficult to webpack.
|
* mock-clock implementation, but again, it is difficult to webpack.
|
||||||
|
*
|
||||||
|
* Hopefully the reasons for c+ping this no longer apply, but until we can
|
||||||
|
* verify this / remove it, disable the eslint rule that it breaks (impresssively
|
||||||
|
* only one, having fixed the long line).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable prefer-rest-params */
|
||||||
|
|
||||||
const j$ = {};
|
const j$ = {};
|
||||||
|
|
||||||
j$.Clock = function() {
|
j$.Clock = function() {
|
||||||
|
@ -67,7 +73,10 @@ j$.Clock = function() {
|
||||||
|
|
||||||
self.install = function() {
|
self.install = function() {
|
||||||
if (!originalTimingFunctionsIntact()) {
|
if (!originalTimingFunctionsIntact()) {
|
||||||
throw new Error('Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?');
|
throw new Error(
|
||||||
|
'Jasmine Clock was unable to install over custom global timer functions. ' +
|
||||||
|
'Is the clock already installed?',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
replace(global, fakeTimingFunctions);
|
replace(global, fakeTimingFunctions);
|
||||||
timer = fakeTimingFunctions;
|
timer = fakeTimingFunctions;
|
||||||
|
|
Loading…
Reference in New Issue