1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into export-conversations

This commit is contained in:
Jaiwanth
2021-08-09 10:44:13 +05:30
86 changed files with 2202 additions and 1969 deletions

View File

@@ -156,13 +156,14 @@ describe('CallHandler', () => {
DMRoomMap.setShared(null);
// @ts-ignore
window.mxCallHandler = null;
fakeCall = null;
MatrixClientPeg.unset();
document.body.removeChild(audioElement);
SdkConfig.unset();
});
it('should look up the correct user and open the room when a phone number is dialled', async () => {
it('should look up the correct user and start a call in the room when a phone number is dialled', async () => {
MatrixClientPeg.get().getThirdpartyUser = jest.fn().mockResolvedValue([{
userid: '@user2:example.org',
protocol: "im.vector.protocol.sip_native",
@@ -179,6 +180,9 @@ describe('CallHandler', () => {
const viewRoomPayload = await untilDispatch('view_room');
expect(viewRoomPayload.room_id).toEqual(MAPPED_ROOM_ID);
// Check that a call was started
expect(fakeCall.roomId).toEqual(MAPPED_ROOM_ID);
});
it('should move calls between rooms when remote asserted identity changes', async () => {

View File

@@ -106,7 +106,7 @@ describe('MemberEventListSummary', function() {
const result = wrapper.props.children;
expect(result.props.children).toEqual([
<div className="event_tile" key="event0">Expanded membership</div>,
<div className="event_tile" key="event0">Expanded membership</div>,
]);
});
@@ -129,8 +129,8 @@ describe('MemberEventListSummary', function() {
const result = wrapper.props.children;
expect(result.props.children).toEqual([
<div className="event_tile" key="event0">Expanded membership</div>,
<div className="event_tile" key="event1">Expanded membership</div>,
<div className="event_tile" key="event0">Expanded membership</div>,
<div className="event_tile" key="event1">Expanded membership</div>,
]);
});

View File

@@ -56,7 +56,7 @@ describe("ContentRules", function() {
describe("parseContentRules", function() {
it("should handle there being no keyword rules", function() {
const rules = { 'global': { 'content': [
USERNAME_RULE,
USERNAME_RULE,
] } };
const parsed = ContentRules.parseContentRules(rules);
expect(parsed.rules).toEqual([]);

View File

@@ -78,6 +78,7 @@ export function createTestClient() {
},
mxcUrlToHttp: (mxc) => 'http://this.is.a.url/',
setAccountData: jest.fn(),
setRoomAccountData: jest.fn(),
sendTyping: jest.fn().mockResolvedValue({}),
sendMessage: () => jest.fn().mockResolvedValue({}),
getSyncState: () => "SYNCING",
@@ -95,6 +96,7 @@ export function createTestClient() {
getItem: jest.fn(),
},
},
pushRules: {},
decryptEventIfNeeded: () => Promise.resolve(),
isUserIgnored: jest.fn().mockReturnValue(false),
getCapabilities: jest.fn().mockResolvedValue({}),
@@ -129,8 +131,8 @@ export function mkEvent(opts) {
if (opts.skey) {
event.state_key = opts.skey;
} else if (["m.room.name", "m.room.topic", "m.room.create", "m.room.join_rules",
"m.room.power_levels", "m.room.topic", "m.room.history_visibility", "m.room.encryption",
"com.example.state"].indexOf(opts.type) !== -1) {
"m.room.power_levels", "m.room.topic", "m.room.history_visibility", "m.room.encryption",
"com.example.state"].indexOf(opts.type) !== -1) {
event.state_key = "";
}
return opts.event ? new MatrixEvent(event) : event;

View File

@@ -49,7 +49,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
it.each(
[[true, true], [true, false],
[false, true], [false, false]],
[false, true], [false, false]],
)("2 unverified: returns 'normal', self-trust = %s, DM = %s", async (trusted, dm) => {
const client = mkClient(trusted);
const room = {
@@ -62,7 +62,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
it.each(
[["verified", true, true], ["verified", true, false],
["verified", false, true], ["warning", false, false]],
["verified", false, true], ["warning", false, false]],
)("2 verified: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => {
const client = mkClient(trusted);
const room = {
@@ -75,7 +75,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
it.each(
[["normal", true, true], ["normal", true, false],
["normal", false, true], ["warning", false, false]],
["normal", false, true], ["warning", false, false]],
)("2 mixed: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => {
const client = mkClient(trusted);
const room = {
@@ -88,7 +88,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
it.each(
[["verified", true, true], ["verified", true, false],
["warning", false, true], ["warning", false, false]],
["warning", false, true], ["warning", false, false]],
)("0 others: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => {
const client = mkClient(trusted);
const room = {
@@ -101,7 +101,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
it.each(
[["verified", true, true], ["verified", true, false],
["verified", false, true], ["verified", false, false]],
["verified", false, true], ["verified", false, false]],
)("1 verified: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => {
const client = mkClient(trusted);
const room = {
@@ -114,7 +114,7 @@ describe("shieldStatusForMembership self-trust behaviour", function() {
it.each(
[["normal", true, true], ["normal", true, false],
["normal", false, true], ["normal", false, false]],
["normal", false, true], ["normal", false, false]],
)("1 unverified: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => {
const client = mkClient(trusted);
const room = {