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
@@ -61,11 +61,6 @@ jest.mock("../../../../src/stores/OwnProfileStore", () => ({
},
}));
// Fake random strings to give a predictable snapshot
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("AppTile", () => {
let cli: MatrixClient;
let r1: Room;
@@ -19,13 +19,6 @@ import React from "react";
import LabelledCheckbox from "../../../../src/components/views/elements/LabelledCheckbox";
// Fake random strings to give a predictable snapshot for checkbox IDs
jest.mock("matrix-js-sdk/src/randomstring", () => {
return {
randomString: () => "abdefghi",
};
});
describe("<LabelledCheckbox />", () => {
type CompProps = React.ComponentProps<typeof LabelledCheckbox>;
const getComponent = (props: CompProps) => <LabelledCheckbox {...props} />;
@@ -276,7 +276,7 @@ exports[`AppTile for a pinned widget should render permission request 1`] = `
<span>
Using this widget may share data
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
class="mx_TextWithTooltip_target mx_TextWithTooltip_target--helpIcon"
tabindex="0"
>
@@ -10,11 +10,11 @@ exports[`<LabelledCheckbox /> should render with byline of "this is a byline" 1`
>
<input
checked=""
id="checkbox_abdefghi"
id="checkbox_vY7Q4uEh9K"
type="checkbox"
/>
<label
for="checkbox_abdefghi"
for="checkbox_vY7Q4uEh9K"
>
<div
class="mx_Checkbox_background"
@@ -53,11 +53,11 @@ exports[`<LabelledCheckbox /> should render with byline of undefined 1`] = `
>
<input
checked=""
id="checkbox_abdefghi"
id="checkbox_vY7Q4uEh9K"
type="checkbox"
/>
<label
for="checkbox_abdefghi"
for="checkbox_vY7Q4uEh9K"
>
<div
class="mx_Checkbox_background"