Skip to content

Commit 573e864

Browse files
committed
test: add tests
1 parent 7a516d6 commit 573e864

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

src/header/Header.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ const Header = ({
6262
buttonTitle: intl.formatMessage(messages['header.links.tools']),
6363
items: toolsMenuItems,
6464
},
65-
] : [
66-
{
67-
id: `${intl.formatMessage(messages['header.links.tools'])}-dropdown-menu`,
68-
buttonTitle: intl.formatMessage(messages['header.links.tools']),
69-
items: libraryToolsMenuItems,
70-
},
71-
];
65+
] : [{
66+
id: `${intl.formatMessage(messages['header.links.tools'])}-dropdown-menu`,
67+
buttonTitle: intl.formatMessage(messages['header.links.tools']),
68+
items: libraryToolsMenuItems,
69+
}];
7270

7371
// Include settings menu only if user is allowed to see them.
7472
if (isLibrary && libraryToolsSettingsItems.length > 0) {

src/header/hooks.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,28 @@ describe('header utils', () => {
145145
const items = renderHook(() => useLibrarySettingsMenuItems('library-123', false)).result.current;
146146
expect(items).toContainEqual({ title: 'Team Access', href: 'http://localhost/?sa=manage-team' });
147147
});
148+
it('should contain admin console url if set', () => {
149+
setConfig({
150+
...getConfig(),
151+
ADMIN_CONSOLE_URL: 'http://admin-console.com',
152+
});
153+
const items = renderHook(() => useLibrarySettingsMenuItems('library-123', false)).result.current;
154+
expect(items).toContainEqual({
155+
title: 'Team Access',
156+
href: 'http://admin-console.com/authz/libraries/library-123',
157+
});
158+
});
159+
it('should contain admin console url if set and readOnly is true', () => {
160+
setConfig({
161+
...getConfig(),
162+
ADMIN_CONSOLE_URL: 'http://admin-console.com',
163+
});
164+
const items = renderHook(() => useLibrarySettingsMenuItems('library-123', true)).result.current;
165+
expect(items).toContainEqual({
166+
title: 'Team Access',
167+
href: 'http://admin-console.com/authz/libraries/library-123',
168+
});
169+
});
148170
});
149171

150172
describe('useLibraryToolsMenuItems', () => {

0 commit comments

Comments
 (0)