Skip to content

Commit

Permalink
Fix Read Receipt Test (#28719)
Browse files Browse the repository at this point in the history
* Update test snapshot

as the date formatting appears to have gained a comma, and somehow
got through the merge tests on the dependency bump.

* Actually this was the problem
  • Loading branch information
dbkr authored Dec 11, 2024
1 parent ba98c20 commit cf3bdbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React, { ComponentProps } from "react";
import { render, screen, waitFor } from "jest-matrix-react";
import { RoomMember } from "matrix-js-sdk/src/matrix";
import userEvent from "@testing-library/user-event";
import { mocked } from "jest-mock";

import {
determineAvatarPosition,
Expand All @@ -20,6 +21,9 @@ import * as languageHandler from "../../../../../src/languageHandler";
import { stubClient } from "../../../../test-utils";
import dispatcher from "../../../../../src/dispatcher/dispatcher";
import { Action } from "../../../../../src/dispatcher/actions";
import { formatDate } from "../../../../../src/DateUtils";

jest.mock("../../../../../src/DateUtils");

describe("ReadReceiptGroup", () => {
describe("TooltipText", () => {
Expand Down Expand Up @@ -87,6 +91,10 @@ describe("ReadReceiptGroup", () => {
describe("<ReadReceiptPerson />", () => {
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 USER_ID = "@alice:example.org";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ exports[`ReadReceiptGroup <ReadReceiptPerson /> should render 1`] = `
<p
class="mx_ReadReceiptGroup_secondary"
>
Wed, 15 May, 0:00
==MOCK FORMATTED DATE==
</p>
</div>
</div>
Expand Down

0 comments on commit cf3bdbd

Please sign in to comment.