fix(explore): Display missing dataset for denied access (#34129)

This commit is contained in:
JUST.in DO IT
2025-07-16 13:36:03 -07:00
committed by GitHub
parent 94d47113ea
commit 96cb6030c8
10 changed files with 263 additions and 78 deletions

View File

@@ -479,3 +479,30 @@ test('should show missing dataset state', () => {
),
).toBeVisible();
});
test('should show forbidden dataset state', () => {
// @ts-ignore
delete window.location;
// @ts-ignore
window.location = { search: '?slice_id=152' };
const error = {
error_type: 'TABLE_SECURITY_ACCESS_ERROR',
statusText: 'FORBIDDEN',
message: 'You do not have access to the following tables: blocked_table',
extra: {
datasource: 152,
datasource_name: 'forbidden dataset',
},
};
const props = createProps({
datasource: {
...fallbackExploreInitialData.dataset,
extra: {
error,
},
},
});
render(<DatasourceControl {...props} />, { useRedux: true, useRouter: true });
expect(screen.getByText(error.message)).toBeInTheDocument();
expect(screen.getByText(error.statusText)).toBeVisible();
});