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
49 changed files with 133 additions and 256 deletions
@@ -28,11 +28,6 @@ import {
makeRoomWithBeacons,
} from "../../../test-utils";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("<BeaconListItem />", () => {
// 14.03.2022 16:15
const now = 1647270879403;
@@ -27,11 +27,6 @@ import {
mockClientMethodsUser,
} from "../../../test-utils";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("<DialogSidebar />", () => {
const defaultProps: ComponentProps<typeof DialogSidebar> = {
beacons: [],
@@ -21,11 +21,6 @@ import ShareLatestLocation from "../../../../src/components/views/beacon/ShareLa
import { copyPlaintext } from "../../../../src/utils/strings";
import { flushPromises } from "../../../test-utils";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
jest.mock("../../../../src/utils/strings", () => ({
copyPlaintext: jest.fn().mockResolvedValue(undefined),
}));
@@ -32,7 +32,7 @@ exports[`<BeaconListItem /> when a beacon is live and has locations renders beac
class="mx_BeaconListItem_interactions"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
tabindex="0"
>
<a
@@ -62,7 +62,7 @@ exports[`<DialogSidebar /> renders sidebar correctly with beacons 1`] = `
class="mx_BeaconListItem_interactions"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
tabindex="0"
>
<a
@@ -3,7 +3,7 @@
exports[`<ShareLatestLocation /> renders share buttons when there is a location 1`] = `
<DocumentFragment>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
tabindex="0"
>
<a