feat: allow uploads in crud view (#18953)

* feat: allow uploads in crud view

* fix merge conflict and fix ts

* fix import

* fix tests

* fix lint

* remove unused var

* fix underline flash and alignment

* fix offset

* fix icon alignment

* fix labels and css issues

* make drowdown primary all the time

* make global

* fix lables

* add upload perms to utils

* remove unused code

* add suggested changes

* update menuright
This commit is contained in:
Phillip Kelley-Dotson
2022-03-21 13:01:36 -07:00
committed by GitHub
parent 9ae51f7a48
commit d771ddbb94
7 changed files with 181 additions and 28 deletions

View File

@@ -18,6 +18,7 @@
*/
import React from 'react';
import thunk from 'redux-thunk';
import * as redux from 'react-redux';
import configureStore from 'redux-mock-store';
import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux';
@@ -40,6 +41,17 @@ import { act } from 'react-dom/test-utils';
const mockStore = configureStore([thunk]);
const store = mockStore({});
const mockAppState = {
common: {
config: {
CSV_EXTENSIONS: ['csv'],
EXCEL_EXTENSIONS: ['xls', 'xlsx'],
COLUMNAR_EXTENSIONS: ['parquet', 'zip'],
ALLOWED_EXTENSIONS: ['parquet', 'zip', 'xls', 'xlsx', 'csv'],
},
},
};
const databasesInfoEndpoint = 'glob:*/api/v1/database/_info*';
const databasesEndpoint = 'glob:*/api/v1/database/?*';
const databaseEndpoint = 'glob:*/api/v1/database/*';
@@ -94,12 +106,22 @@ fetchMock.get(databaseRelatedEndpoint, {
},
});
const useSelectorMock = jest.spyOn(redux, 'useSelector');
describe('DatabaseList', () => {
useSelectorMock.mockReturnValue({
CSV_EXTENSIONS: ['csv'],
EXCEL_EXTENSIONS: ['xls', 'xlsx'],
COLUMNAR_EXTENSIONS: ['parquet', 'zip'],
ALLOWED_EXTENSIONS: ['parquet', 'zip', 'xls', 'xlsx', 'csv'],
});
const wrapper = mount(
<Provider store={store}>
<DatabaseList user={mockUser} />
</Provider>,
);
beforeAll(async () => {
await waitForComponentToPaint(wrapper);
});
@@ -195,6 +217,7 @@ describe('RTL', () => {
<DatabaseList user={mockUser} />
</QueryParamProvider>,
{ useRedux: true },
mockAppState,
);
});