mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
refactor: convert DatasetList schema filter to use new distinct api (#10746)
This commit is contained in:
@@ -35,6 +35,7 @@ const store = mockStore({});
|
||||
|
||||
const datasetsInfoEndpoint = 'glob:*/api/v1/dataset/_info*';
|
||||
const datasetsOwnersEndpoint = 'glob:*/api/v1/dataset/related/owners*';
|
||||
const datasetsSchemaEndpoint = 'glob:*/api/v1/dataset/distinct/schema*';
|
||||
const databaseEndpoint = 'glob:*/api/v1/dataset/related/database*';
|
||||
const datasetsEndpoint = 'glob:*/api/v1/dataset/?*';
|
||||
|
||||
@@ -57,6 +58,9 @@ fetchMock.get(datasetsInfoEndpoint, {
|
||||
fetchMock.get(datasetsOwnersEndpoint, {
|
||||
result: [],
|
||||
});
|
||||
fetchMock.get(datasetsSchemaEndpoint, {
|
||||
result: [],
|
||||
});
|
||||
fetchMock.get(datasetsEndpoint, {
|
||||
result: mockdatasets,
|
||||
dataset_count: 3,
|
||||
@@ -97,12 +101,20 @@ describe('DatasetList', () => {
|
||||
|
||||
it('fetches data', () => {
|
||||
const callsD = fetchMock.calls(/dataset\/\?q/);
|
||||
expect(callsD).toHaveLength(2);
|
||||
expect(callsD[1][0]).toMatchInlineSnapshot(
|
||||
expect(callsD).toHaveLength(1);
|
||||
expect(callsD[0][0]).toMatchInlineSnapshot(
|
||||
`"http://localhost/api/v1/dataset/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25)"`,
|
||||
);
|
||||
});
|
||||
|
||||
it('fetches owner filter values', () => {
|
||||
expect(fetchMock.calls(/dataset\/related\/owners/)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('fetches schema filter values', () => {
|
||||
expect(fetchMock.calls(/dataset\/distinct\/schema/)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('shows/hides bulk actions when bulk actions is clicked', async () => {
|
||||
await waitForComponentToPaint(wrapper);
|
||||
const button = wrapper.find(Button).at(0);
|
||||
|
||||
Reference in New Issue
Block a user