From 2ad0032f724ba8665abacbd55ab819ae3acc2250 Mon Sep 17 00:00:00 2001 From: Ayush PS Date: Sun, 9 May 2021 01:10:54 +0530 Subject: [PATCH] Added regression tests for Natural headers --- .../structures/MessagePanel-test.js | 42 ------------------- test/test-utils.js | 33 --------------- 2 files changed, 75 deletions(-) diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index 55879a2f5c..42819235dd 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -264,33 +264,6 @@ describe('MessagePanel', function() { }), ]; } - - //Create a few redacted events - //isRedacted just checks the redacted_because - function mkRedactionEvents() { - const events = []; - const ts0 = Date.now(); - let i=0 - - let redaction = test_utils.mkEvent({ - type: "m.room.redaction", - event: true, room: "!room:id", user: "@user:id", ts: ts0 + ++i * 1000 , - content: {}, - }); - let event =test_utils.mkRedactedEvent({ - type: "m.room.message", - event: true, room: "!room:id", user: "@user:id", - ts: ts0 + i * 1000 , - // redacted_because: redaction This is not working at the moment - }) - redaction.redacts = event.event_id; - - events.push(event); - events.push(redaction); - - return events; - - } function isReadMarkerVisible(rmContainer) { return rmContainer && rmContainer.children.length > 0; @@ -493,19 +466,4 @@ describe('MessagePanel', function() { }) - - it('should render only one Date separator for redacted events', function () { - const events = mkRedactionEvents() - const res = mount( - , - ); - const Dates = res.find(sdk.getComponent('messages.DateSeparator')); - - expect(Dates.length).toEqual(1); - - - }) }); diff --git a/test/test-utils.js b/test/test-utils.js index b259d97d04..6dc02463a5 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -218,39 +218,6 @@ export function mkMessage(opts) { return mkEvent(opts); } - -/** - * Create an Redacted Event. - * @param {Object} opts Values for the event. - * @param {string} opts.type The event.type - * @param {string} opts.room The event.room_id - * @param {string} opts.user The event.user_id - * @param {string} opts.skey Optional. The state key (auto inserts empty string) - * @param {Number} opts.ts Optional. Timestamp for the event - * @param {Object} opts.content The event.content - * @param {boolean} opts.event True to make a MatrixEvent. - * @return {Object} a JSON object representing this event. - */ - export function mkRedactedEvent(opts) { - if (!opts.type ) { - throw new Error("Missing .type =>" + JSON.stringify(opts)); - } - const event = { - type: opts.type, - room_id: opts.room, - sender: opts.user, - content: {}, - prev_content: opts.prev_content, - event_id: "$" + Math.random() + "-" + Math.random(), - origin_server_ts: opts.ts, - //isRedacted() only checks if redacted_because is true or not - // unsigned :{redacted_because:opts.redacted_because} This is not working atm - }; - //Might want to add the other parameters for generalized tests - return opts.event ? new MatrixEvent(event) : event; -} - - export function mkStubRoom(roomId = null) { const stubTimeline = { getEvents: () => [] }; return {