Actually this was the problem

This commit is contained in:
David Baker 2024-12-11 14:00:42 +00:00
parent cf07a6b9cc
commit 6a17bf17b9
2 changed files with 9 additions and 1 deletions

View file

@ -10,6 +10,7 @@ import React, { ComponentProps } from "react";
import { render, screen, waitFor } from "jest-matrix-react"; import { render, screen, waitFor } from "jest-matrix-react";
import { RoomMember } from "matrix-js-sdk/src/matrix"; import { RoomMember } from "matrix-js-sdk/src/matrix";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { mocked } from "jest-mock";
import { import {
determineAvatarPosition, determineAvatarPosition,
@ -20,6 +21,9 @@ import * as languageHandler from "../../../../../src/languageHandler";
import { stubClient } from "../../../../test-utils"; import { stubClient } from "../../../../test-utils";
import dispatcher from "../../../../../src/dispatcher/dispatcher"; import dispatcher from "../../../../../src/dispatcher/dispatcher";
import { Action } from "../../../../../src/dispatcher/actions"; import { Action } from "../../../../../src/dispatcher/actions";
import { formatDate } from "../../../../../src/DateUtils";
jest.mock("../../../../../src/DateUtils");
describe("ReadReceiptGroup", () => { describe("ReadReceiptGroup", () => {
describe("TooltipText", () => { describe("TooltipText", () => {
@ -87,6 +91,10 @@ describe("ReadReceiptGroup", () => {
describe("<ReadReceiptPerson />", () => { describe("<ReadReceiptPerson />", () => {
stubClient(); stubClient();
// We pick a fixed time but this can still vary depending on the locale
// the tests are run in. We are not testing date formatting here, so stub it out.
mocked(formatDate).mockReturnValue("==MOCK FORMATTED DATE==");
const ROOM_ID = "roomId"; const ROOM_ID = "roomId";
const USER_ID = "@alice:example.org"; const USER_ID = "@alice:example.org";

View file

@ -84,7 +84,7 @@ exports[`ReadReceiptGroup <ReadReceiptPerson /> should render 1`] = `
<p <p
class="mx_ReadReceiptGroup_secondary" class="mx_ReadReceiptGroup_secondary"
> >
Wed, May 15, 00:00 ==MOCK FORMATTED DATE==
</p> </p>
</div> </div>
</div> </div>