16719: Don't try to click something to force logout, just reload the page.
[arvados-workbench2.git] / src / views-components / context-menu / actions / helpers.test.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { sanitizeToken, getClipboardUrl } from "./helpers";
6
7 describe('helpers', () => {
8     // given
9     const url = 'https://collections.ardev.roche.com/c=ardev-4zz18-k0hamvtwyit6q56/t=v2/arlog-gj3su-stk5unu8570brvs/fryzaq6z1ow1npak5nngldtkoup918isrvlualf134uf1fbtd/LIMS/1.html';
10
11     describe('sanitizeToken', () => {
12         it('should sanitize token from the url', () => {
13             // when
14             const result = sanitizeToken(url);
15
16             // then
17             expect(result).toBe('https://collections.ardev.roche.com/c=ardev-4zz18-k0hamvtwyit6q56/LIMS/1.html?api_token=v2/arlog-gj3su-stk5unu8570brvs/fryzaq6z1ow1npak5nngldtkoup918isrvlualf134uf1fbtd');
18         });
19     });
20
21     describe('getClipboardUrl', () => {
22         it('should add redirectTo query param', () => {
23             // when
24             const result = getClipboardUrl(url);
25
26             // then
27             expect(result).toBe('http://localhost?redirectTo=https://collections.ardev.roche.com/c=ardev-4zz18-k0hamvtwyit6q56/LIMS/1.html');
28         });
29     });
30 });