mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
fix: Changes ResultSet to include sqlEditorImmutableId when fetching results (#35773)
This commit is contained in:
committed by
GitHub
parent
4a3453999a
commit
337da13ba7
@@ -602,4 +602,42 @@ describe('ResultSet', () => {
|
||||
);
|
||||
expect(queryByTestId('copy-to-clipboard-button')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should include sqlEditorImmutableId in query object when fetching results', async () => {
|
||||
const queryWithResultsKey = {
|
||||
...queries[0],
|
||||
resultsKey: 'test-results-key',
|
||||
sqlEditorImmutableId: 'test-immutable-id-123',
|
||||
};
|
||||
|
||||
const store = mockStore({
|
||||
...initialState,
|
||||
user,
|
||||
sqlLab: {
|
||||
...initialState.sqlLab,
|
||||
queries: {
|
||||
[queryWithResultsKey.id]: queryWithResultsKey,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
setup({ ...mockedProps, queryId: queryWithResultsKey.id }, store);
|
||||
|
||||
await waitFor(() => {
|
||||
// Check that REQUEST_QUERY_RESULTS action was dispatched
|
||||
const actions = store.getActions();
|
||||
const requestAction = actions.find(
|
||||
action => action.type === 'REQUEST_QUERY_RESULTS',
|
||||
);
|
||||
expect(requestAction).toBeDefined();
|
||||
// Verify sqlEditorImmutableId is present in the query object
|
||||
expect(requestAction?.query?.sqlEditorImmutableId).toBe(
|
||||
'test-immutable-id-123',
|
||||
);
|
||||
});
|
||||
|
||||
// Verify the API was called
|
||||
const resultsCalls = fetchMock.calls('glob:*/api/v1/sqllab/results/*');
|
||||
expect(resultsCalls).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user