Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sqllab): empty large query results from localStorage #23302

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
replace test spec by constants
  • Loading branch information
justinpark committed Mar 9, 2023
commit 194d928430d5d6b247b67b83a93b6d8e97f850c9
22 changes: 11 additions & 11 deletions superset-frontend/src/SqlLab/utils/emptyQueryResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import {
emptyQueryResults,
clearQueryEditors,
} from 'src/SqlLab/utils/reduxStateToLocalStorageHelper';
import { LOCALSTORAGE_MAX_QUERY_AGE_MS } from 'src/SqlLab/constants';
import {
KB_STORAGE,
BYTES_PER_CHAR,
LOCALSTORAGE_MAX_QUERY_AGE_MS,
LOCALSTORAGE_MAX_QUERY_RESULTS_KB,
} from 'src/SqlLab/constants';
import { queries, defaultQueryEditor } from '../fixtures';

jest.mock('src/SqlLab/constants', () => ({
...jest.requireActual('src/SqlLab/constants'),
LOCALSTORAGE_MAX_QUERY_RESULTS_KB: 1,
}));

describe('reduxStateToLocalStorageHelper', () => {
const queriesObj = {};
beforeEach(() => {
Expand Down Expand Up @@ -62,11 +62,11 @@ describe('reduxStateToLocalStorageHelper', () => {
results: {
data: [
{
test: 1123123123123,
stringValue:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum',
jsonValue:
'{"a":1234234234234234,"b":21234123412341234,"c":31234123412341234,"str":"something long text goes here"}',
jsonValue: `{"str":"${new Array(
(LOCALSTORAGE_MAX_QUERY_RESULTS_KB / BYTES_PER_CHAR) * KB_STORAGE,
)
.fill(0)
.join('')}"}`,
},
],
},
Expand Down