Device manager - other sessions list (PSG-637) (#9155)
* add session manager tab to user settings * fussy import ordering * i18n * basic sorted list outline * rename to filtered device list * exclude current device session from other sessions list * test other sessions section
This commit is contained in:
parent
09aade2907
commit
0be622e7f0
8 changed files with 193 additions and 4 deletions
|
@ -40,6 +40,12 @@ describe('<SessionManagerTab />', () => {
|
|||
};
|
||||
const alicesMobileDevice = {
|
||||
device_id: 'alices_mobile_device',
|
||||
last_seen_ts: Date.now(),
|
||||
};
|
||||
|
||||
const alicesOlderMobileDevice = {
|
||||
device_id: 'alices_older_mobile_device',
|
||||
last_seen_ts: Date.now() - 600000,
|
||||
};
|
||||
|
||||
const mockCrossSigningInfo = {
|
||||
|
@ -139,8 +145,6 @@ describe('<SessionManagerTab />', () => {
|
|||
|
||||
it('renders current session section', async () => {
|
||||
mockClient.getDevices.mockResolvedValue({ devices: [alicesDevice, alicesMobileDevice] });
|
||||
const noCryptoError = new Error("End-to-end encryption disabled");
|
||||
mockClient.getStoredDevice.mockImplementation(() => { throw noCryptoError; });
|
||||
const { getByTestId } = render(getComponent());
|
||||
|
||||
await act(async () => {
|
||||
|
@ -149,4 +153,28 @@ describe('<SessionManagerTab />', () => {
|
|||
|
||||
expect(getByTestId('current-session-section')).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('does not render other sessions section when user has only one device', async () => {
|
||||
mockClient.getDevices.mockResolvedValue({ devices: [alicesDevice] });
|
||||
const { queryByTestId } = render(getComponent());
|
||||
|
||||
await act(async () => {
|
||||
await flushPromisesWithFakeTimers();
|
||||
});
|
||||
|
||||
expect(queryByTestId('other-sessions-section')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('renders other sessions section', async () => {
|
||||
mockClient.getDevices.mockResolvedValue({
|
||||
devices: [alicesDevice, alicesOlderMobileDevice, alicesMobileDevice],
|
||||
});
|
||||
const { getByTestId } = render(getComponent());
|
||||
|
||||
await act(async () => {
|
||||
await flushPromisesWithFakeTimers();
|
||||
});
|
||||
|
||||
expect(getByTestId('other-sessions-section')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue