You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
Fix instances of double translation and guard translation calls using typescript (#11443)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d13b6e1b41
commit
ac70f7ac9b
@ -14,7 +14,15 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { EventType, JoinRule, MatrixClient, MatrixEvent, Room, RoomMember } from "matrix-js-sdk/src/matrix";
|
||||
import {
|
||||
EventType,
|
||||
HistoryVisibility,
|
||||
JoinRule,
|
||||
MatrixClient,
|
||||
MatrixEvent,
|
||||
Room,
|
||||
RoomMember,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { render } from "@testing-library/react";
|
||||
import { ReactElement } from "react";
|
||||
import { Mocked, mocked } from "jest-mock";
|
||||
@ -571,4 +579,39 @@ describe("TextForEvent", () => {
|
||||
).toEqual("@a changed the join rule to a not implemented one");
|
||||
});
|
||||
});
|
||||
|
||||
describe("textForHistoryVisibilityEvent()", () => {
|
||||
type TestCase = [string, { result: string }];
|
||||
const testCases: TestCase[] = [
|
||||
[
|
||||
HistoryVisibility.Invited,
|
||||
{ result: "@a made future room history visible to all room members, from the point they are invited." },
|
||||
],
|
||||
[
|
||||
HistoryVisibility.Joined,
|
||||
{ result: "@a made future room history visible to all room members, from the point they joined." },
|
||||
],
|
||||
[HistoryVisibility.Shared, { result: "@a made future room history visible to all room members." }],
|
||||
[HistoryVisibility.WorldReadable, { result: "@a made future room history visible to anyone." }],
|
||||
];
|
||||
|
||||
it.each(testCases)(
|
||||
"returns correct message when room join rule changed to %s",
|
||||
(historyVisibility, { result }) => {
|
||||
expect(
|
||||
textForEvent(
|
||||
new MatrixEvent({
|
||||
type: "m.room.history_visibility",
|
||||
sender: "@a",
|
||||
content: {
|
||||
history_visibility: historyVisibility,
|
||||
},
|
||||
state_key: "",
|
||||
}),
|
||||
mockClient,
|
||||
),
|
||||
).toEqual(result);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user