You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-31 13:44:28 +03:00
Update tests to prefer RTL over Enzyme (#10247
* Update tests to prefer RTL over Enzyme * Strict types
This commit is contained in:
committed by
GitHub
parent
dd6fc124d7
commit
f40d15388c
@ -30,7 +30,7 @@ describe("DMRoomMap", () => {
|
||||
"user@example.com": [roomId1, roomId2],
|
||||
"@user:example.com": [roomId1, roomId3, roomId4],
|
||||
"@user2:example.com": [] as string[],
|
||||
} satisfies IContent;
|
||||
} as IContent;
|
||||
|
||||
let client: Mocked<MatrixClient>;
|
||||
let dmRoomMap: DMRoomMap;
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderToString } from "react-dom/server";
|
||||
import { render } from "@testing-library/react";
|
||||
import {
|
||||
IContent,
|
||||
MatrixClient,
|
||||
@ -227,6 +227,10 @@ describe("export", function () {
|
||||
return matrixEvents;
|
||||
}
|
||||
|
||||
function renderToString(elem: JSX.Element): string {
|
||||
return render(elem).container.outerHTML;
|
||||
}
|
||||
|
||||
it("checks if the export format is valid", function () {
|
||||
function isValidFormat(format: string): boolean {
|
||||
const options: string[] = Object.values(ExportFormat);
|
||||
@ -255,7 +259,7 @@ describe("export", function () {
|
||||
},
|
||||
setProgressText,
|
||||
);
|
||||
const imageRegex = /<img.+ src="mxc:\/\/test.org" alt="image.png"\/>/;
|
||||
const imageRegex = /<img.+ src="mxc:\/\/test.org" alt="image\.png"\/?>/;
|
||||
expect(imageRegex.test(renderToString(exporter.getEventTile(mkImageEvent(), true)))).toBeTruthy();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user