Skip to content

Commit

Permalink
get test to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed Feb 15, 2024
1 parent 6024893 commit e4dc4de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ function getReportData(request: GoogleAppsScript.Data_Studio.Request<ConnectorPa
const report = request.configParams.report;
const segment = request.configParams.segment || '';

const filter_limit = request.configParams.filter_limit
? parseInt(request.configParams.filter_limit, 10)
: -1;

if (!filter_limit) {
throwUserError(`Invalid default row limit ${filter_limit} supplied.`);
let filter_limit = -1;
if (request.configParams.filter_limit) {
filter_limit = parseInt(request.configParams.filter_limit, 10);
if (filter_limit <= 0 || Number.isNaN(filter_limit)) {
throwUserError(`Invalid default row limit ${filter_limit} supplied.`);
}
}

let rowsToFetchAtATime = parseInt(env.MAX_ROWS_TO_FETCH_PER_REQUEST, 10) || 100000;
Expand Down
2 changes: 1 addition & 1 deletion tests/appscript/data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ describe('data', () => {
});

for (let limit of ['-1', '0', 'sadlfjk']) {
it('should fail if an invalid filter_limit is specified', async () => {
it(`should fail if an invalid filter_limit is specified (${limit})`, async () => {
await expect(async () => {
await Clasp.run('getData', {
configParams: {
Expand Down

0 comments on commit e4dc4de

Please sign in to comment.