From 41b481a8f5233609e3e457ebc5a1530056a57fc4 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Fri, 24 Feb 2023 08:47:06 -0500 Subject: [PATCH] Pass push rules through rewriteDefaultRules for compatibility with matrix-js-sdk#3134. --- test/utils/pillify-test.tsx | 49 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/test/utils/pillify-test.tsx b/test/utils/pillify-test.tsx index 5ee8b280def..9809ecfc50a 100644 --- a/test/utils/pillify-test.tsx +++ b/test/utils/pillify-test.tsx @@ -18,6 +18,7 @@ import React from "react"; import { render } from "@testing-library/react"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { ConditionKind, EventType, PushRuleActionName, Room, TweakName } from "matrix-js-sdk/src/matrix"; +import { PushProcessor } from "matrix-js-sdk/src/pushprocessor"; import { pillifyLinks } from "../../src/utils/pillify"; import { stubClient } from "../test-utils"; @@ -38,29 +39,31 @@ describe("pillify", () => { stubClient(); const cli = MatrixClientPeg.get(); (cli.getRoom as jest.Mock).mockReturnValue(new Room(roomId, cli, cli.getUserId()!)); - cli.pushRules!.global = { - override: [ - { - rule_id: ".m.rule.roomnotif", - default: true, - enabled: true, - conditions: [ - { - kind: ConditionKind.EventMatch, - key: "content.body", - pattern: "@room", - }, - ], - actions: [ - PushRuleActionName.Notify, - { - set_tweak: TweakName.Highlight, - value: true, - }, - ], - }, - ], - }; + cli.pushRules = PushProcessor.rewriteDefaultRules({ + global: { + override: [ + { + rule_id: ".m.rule.roomnotif", + default: true, + enabled: true, + conditions: [ + { + kind: ConditionKind.EventMatch, + key: "content.body", + pattern: "@room", + }, + ], + actions: [ + PushRuleActionName.Notify, + { + set_tweak: TweakName.Highlight, + value: true, + }, + ], + }, + ], + }, + }); DMRoomMap.makeShared(); });