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
@@ -23,13 +23,6 @@ import ManageRestrictedJoinRuleDialog from "../../../../src/components/views/dia
import SpaceStore from "../../../../src/stores/spaces/SpaceStore";
import DMRoomMap from "../../../../src/utils/DMRoomMap";
// Fake random strings to give a predictable snapshot
jest.mock("matrix-js-sdk/src/randomstring", () => {
return {
randomString: () => "abdefghi",
};
});
describe("<ManageRestrictedJoinRuleDialog />", () => {
const userId = "@alice:server.org";
const mockClient = getMockClientWithEventEmitter({
@@ -23,11 +23,6 @@ import SdkConfig from "../../../../src/SdkConfig";
import { flushPromises } from "../../../test-utils";
import { ValidatedServerConfig } from "../../../../src/utils/ValidatedServerConfig";
// Fake random strings to give a predictable snapshot for IDs
jest.mock("matrix-js-sdk/src/randomstring", () => ({
randomString: () => "abdefghi",
}));
describe("<ServerPickerDialog />", () => {
const defaultServerConfig = {
hsUrl: "https://matrix.org",
@@ -107,11 +107,11 @@ exports[`<ManageRestrictedJoinRuleDialog /> should list spaces which are not par
class="mx_Checkbox mx_Checkbox_hasKind mx_Checkbox_kind_solid"
>
<input
id="checkbox_abdefghi"
id="checkbox_vY7Q4uEh9K"
type="checkbox"
/>
<label
for="checkbox_abdefghi"
for="checkbox_vY7Q4uEh9K"
>
<div
class="mx_Checkbox_background"
@@ -56,7 +56,7 @@ exports[`<ServerPickerDialog /> should render dialog 1`] = `
class="mx_StyledRadioButton_content"
>
<div
aria-describedby="mx_TooltipTarget_abdefghi"
aria-describedby="mx_TooltipTarget_vY7Q4uEh"
class="mx_TextWithTooltip_target mx_Login_underlinedServerName"
tabindex="0"
>