Improve randomString mock for better snapshots (#11375)

This commit is contained in:
Michael Telatynski 2023-08-09 09:39:48 +01:00 committed by GitHub
parent c3574c2050
commit 57a0d99dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 133 additions and 256 deletions

View file

@ -36,11 +36,6 @@ import defaultDispatcher from "../../../../../src/dispatcher/dispatcher";
import { Action } from "../../../../../src/dispatcher/actions";
import MatrixClientContext from "../../../../../src/contexts/MatrixClientContext";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("<PollHistory />", () => {
// 14.03.2022 16:15
const now = 1647270879403;

View file

@ -21,11 +21,6 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { PollListItem } from "../../../../../src/components/views/polls/pollHistory/PollListItem";
import { makePollStartEvent, mockIntlDateTimeFormat, unmockIntlDateTimeFormat } from "../../../../test-utils";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("<PollListItem />", () => {
const event = makePollStartEvent("Question?", "@me:domain.org");
event.getContent().origin;

View file

@ -32,11 +32,6 @@ import {
unmockIntlDateTimeFormat,
} from "../../../../test-utils";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("<PollListItemEnded />", () => {
const userId = "@alice:domain.org";
const roomId = "!room:domain.org";

View file

@ -79,7 +79,7 @@ exports[`<PollHistory /> renders a list of active polls when there are polls in
data-testid="pollListItem-$2"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_PomxwKpa"
tabindex="0"
>
<div
@ -104,7 +104,7 @@ exports[`<PollHistory /> renders a list of active polls when there are polls in
data-testid="pollListItem-$1"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_tmBG4yVC"
tabindex="0"
>
<div

View file

@ -7,7 +7,7 @@ exports[`<PollListItem /> renders a poll 1`] = `
data-testid="pollListItem-$mypoll"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
tabindex="0"
>
<div

View file

@ -7,7 +7,7 @@ exports[`<PollListItemEnded /> renders a poll with no responses 1`] = `
data-testid="pollListItem-1"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
tabindex="0"
>
<div