Skip to content

Commit 8f9b88e

Browse files
Test fixes
1 parent 1aac55f commit 8f9b88e

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

src/platform/plugins/shared/dashboard/public/dashboard_api/save_modal/__snapshots__/save_modal.test.js.snap

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/platform/plugins/shared/dashboard/public/dashboard_app/access_control/check_global_manage_control_privilege.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import { coreServices } from '../../services/kibana_services';
1111

1212
export const checkGlobalManageControlPrivilege = async () => {
13-
const { isGloballyAuthorized } = await coreServices.http.get<{
13+
const response = await coreServices.http.get<{
1414
isGloballyAuthorized: boolean;
1515
}>('/api/dashboards/dashboard/access-control/global-authorization', {
1616
query: { apiVersion: '1' },
1717
});
1818

19-
return isGloballyAuthorized;
19+
return Boolean(response?.isGloballyAuthorized);
2020
};

src/platform/plugins/shared/dashboard/public/dashboard_app/hooks/use_access_control.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const useAccessControl = ({ accessControl, createdBy }: UseAccessControl)
3737
const canManage = checkUserAccessControl({
3838
accessControl,
3939
createdBy,
40-
userId: user.profile_uid,
40+
userId: user?.profile_uid,
4141
});
4242
setCanManageAccessControl(isGloballyAuthorized || canManage);
4343
};
@@ -48,7 +48,7 @@ export const useAccessControl = ({ accessControl, createdBy }: UseAccessControl)
4848
useEffect(() => {
4949
const getAuthorName = async () => {
5050
const author = await getBulkAuthorNames([accessControl?.owner || createdBy]);
51-
setAuthorName(author[0].username);
51+
setAuthorName(author[0]?.username);
5252
};
5353

5454
getAuthorName();

src/platform/plugins/shared/dashboard/public/dashboard_listing/dashboard_unsaved_listing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const DashboardUnsavedItem = ({
7979
}) => {
8080
const styles = useMemoCss(unsavedItemStyles);
8181
return (
82-
<div css={styles.item}>
82+
<div css={styles.item} key={id}>
8383
<EuiFlexGroup alignItems="center" gutterSize="none" css={styles.heading} responsive={false}>
8484
<EuiFlexItem grow={false}>
8585
<EuiIcon color="text" css={styles.icon} type={title ? 'dashboardApp' : 'clock'} />

src/platform/plugins/shared/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ describe('useDashboardListingTable', () => {
156156
urlStateEnabled: false,
157157
contentEditor: {
158158
onSave: expect.any(Function),
159-
isReadonly: false,
160159
customValidators: expect.any(Object),
161160
},
162161
createdByEnabled: true,
163162
recentlyAccessed: expect.objectContaining({ get: expect.any(Function) }),
163+
rowItemActions: expect.any(Function),
164164
};
165165

166166
expect(tableListViewTableProps).toEqual(expectedProps);

src/platform/plugins/shared/dashboard/public/services/dashboard_content_management_service/lib/save_dashboard_state.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ describe('Save dashboard state', () => {
7171
expect(result.redirectRequired).toBe(true);
7272
expect(contentManagementService.client.create).toHaveBeenCalledWith(
7373
expect.objectContaining({
74-
options: { references: [] },
74+
options: expect.objectContaining({
75+
references: [],
76+
}),
7577
})
7678
);
7779
expect(coreServices.notifications.toasts.addSuccess).toHaveBeenCalledWith({

0 commit comments

Comments
 (0)