Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1845e92

Browse files
committed
Add snapshot test to UserInfo-test.tsx
1 parent 29aa12a commit 1845e92

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

test/components/views/right_panel/UserInfo-test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,21 @@ describe("<DeviceItem />", () => {
488488
expect(mockVerifyDevice).toHaveBeenCalledTimes(1);
489489
expect(mockVerifyDevice).toHaveBeenCalledWith(defaultUser, device);
490490
});
491+
492+
it("with display name", async () => {
493+
const { container } = renderComponent();
494+
await act(flushPromises);
495+
496+
expect(container).toMatchSnapshot();
497+
});
498+
499+
it("without display name", async () => {
500+
const device = { deviceId: "deviceId" } as Device;
501+
const { container } = renderComponent({ device, userId: defaultUserId });
502+
await act(flushPromises);
503+
504+
expect(container).toMatchSnapshot();
505+
});
491506
});
492507

493508
describe("<UserOptionsSection />", () => {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<DeviceItem /> with display name 1`] = `
4+
<div>
5+
<div
6+
class="mx_AccessibleButton mx_UserInfo_device mx_UserInfo_device_unverified"
7+
role="button"
8+
tabindex="0"
9+
title="deviceId"
10+
>
11+
<div
12+
class="mx_E2EIcon mx_E2EIcon_normal"
13+
/>
14+
<div
15+
class="mx_UserInfo_device_name"
16+
>
17+
deviceName
18+
</div>
19+
<div
20+
class="mx_UserInfo_device_trusted"
21+
/>
22+
</div>
23+
</div>
24+
`;
25+
26+
exports[`<DeviceItem /> without display name 1`] = `
27+
<div>
28+
<div
29+
class="mx_AccessibleButton mx_UserInfo_device mx_UserInfo_device_unverified"
30+
role="button"
31+
tabindex="0"
32+
title="deviceId"
33+
>
34+
<div
35+
class="mx_E2EIcon mx_E2EIcon_normal"
36+
/>
37+
<div
38+
class="mx_UserInfo_device_name"
39+
>
40+
deviceId
41+
</div>
42+
<div
43+
class="mx_UserInfo_device_trusted"
44+
/>
45+
</div>
46+
</div>
47+
`;

0 commit comments

Comments
 (0)