parent
4c8b4116eb
commit
970d1912e5
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import EventEmitter from "events";
|
import EventEmitter from "events";
|
||||||
import { MethodKeysOf, mocked, MockedObject, PropertyKeysOf } from "jest-mock";
|
import { MethodKeysOf, mocked, MockedObject, PropertyKeysOf } from "jest-mock";
|
||||||
|
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
|
||||||
import { MatrixClient, User } from "matrix-js-sdk/src/matrix";
|
import { MatrixClient, User } from "matrix-js-sdk/src/matrix";
|
||||||
|
|
||||||
import { MatrixClientPeg } from "../../src/MatrixClientPeg";
|
import { MatrixClientPeg } from "../../src/MatrixClientPeg";
|
||||||
|
@ -50,6 +51,11 @@ export const getMockClientWithEventEmitter = (
|
||||||
const mock = mocked(new MockClientWithEventEmitter(mockProperties) as unknown as MatrixClient);
|
const mock = mocked(new MockClientWithEventEmitter(mockProperties) as unknown as MatrixClient);
|
||||||
|
|
||||||
jest.spyOn(MatrixClientPeg, 'get').mockReturnValue(mock);
|
jest.spyOn(MatrixClientPeg, 'get').mockReturnValue(mock);
|
||||||
|
|
||||||
|
mock.canSupport = new Map();
|
||||||
|
Object.keys(Feature).forEach(feature => {
|
||||||
|
mock.canSupport.set(feature as Feature, ServerSupport.Stable);
|
||||||
|
});
|
||||||
return mock;
|
return mock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import {
|
||||||
import { normalize } from "matrix-js-sdk/src/utils";
|
import { normalize } from "matrix-js-sdk/src/utils";
|
||||||
import { ReEmitter } from "matrix-js-sdk/src/ReEmitter";
|
import { ReEmitter } from "matrix-js-sdk/src/ReEmitter";
|
||||||
import { MediaHandler } from "matrix-js-sdk/src/webrtc/mediaHandler";
|
import { MediaHandler } from "matrix-js-sdk/src/webrtc/mediaHandler";
|
||||||
|
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
|
||||||
|
|
||||||
import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg';
|
import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg';
|
||||||
import { makeType } from "../../src/utils/TypeUtils";
|
import { makeType } from "../../src/utils/TypeUtils";
|
||||||
|
@ -187,6 +188,11 @@ export function createTestClient(): MatrixClient {
|
||||||
|
|
||||||
client.reEmitter = new ReEmitter(client);
|
client.reEmitter = new ReEmitter(client);
|
||||||
|
|
||||||
|
client.canSupport = new Map();
|
||||||
|
Object.keys(Feature).forEach(feature => {
|
||||||
|
client.canSupport.set(feature as Feature, ServerSupport.Stable);
|
||||||
|
});
|
||||||
|
|
||||||
Object.defineProperty(client, "pollingTurnServers", {
|
Object.defineProperty(client, "pollingTurnServers", {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
get: () => true,
|
get: () => true,
|
||||||
|
|
Loading…
Reference in New Issue