Skip to content

Commit

Permalink
do not overwrite idGoal parameter if found in API metadata (#70)
Browse files Browse the repository at this point in the history
* do not overwrite idGoal parameter if found in API metadata

* throw if localtunnel setup fails

* debug failing test

* try to fix the test failure with a timeout?

* more debugging

* remove debugging code

* remove default filter when getting all reports in tests

* add missing expected test files
  • Loading branch information
diosmosis authored Sep 11, 2024
1 parent 5670dd5 commit d16543d
Show file tree
Hide file tree
Showing 148 changed files with 19,134 additions and 136 deletions.
4 changes: 3 additions & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@ function getReportData(request: GoogleAppsScript.Data_Studio.Request<ConnectorPa
filter_limit: `${limitToUse}`,
filter_offset: `${offset}`,
showColumns,
apiModule: null,
apiAction: null,
};

if (reportParams.apiModule !== 'Goals') {
if (reportParams.apiModule !== 'Goals' && typeof params.idGoal === 'undefined') {
params.filter_update_columns_when_show_all_goals = '1';
params.idGoal = '0'; // calculate extra metrics for all goals
}
Expand Down
9 changes: 8 additions & 1 deletion tests/appscript/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ describe('api', () => {
port: 3000,
host: process.env.USE_LOCALTUNNEL,
});

if ( ! tunnel.url ) {
throw new Error('Failed to setup localtunnel!');
}
});

beforeAll(async () => {
Expand Down Expand Up @@ -128,7 +132,7 @@ describe('api', () => {
const result = await Clasp.run('setCredentials', {
userToken: {
username: `${ tunnel.url }/forced-random-error/`,
token: 'ignored',
token: 'forcedrandomerror',
},
});

Expand Down Expand Up @@ -167,6 +171,9 @@ describe('api', () => {
},
});

// waiting seems to be required here, or the mock server isn't used in time
await new Promise((resolve) => setTimeout(resolve, 5000));

// use the mock server's path that forces a non-random error
await Clasp.run('setCredentials', {
userToken: {
Expand Down
2 changes: 1 addition & 1 deletion tests/appscript/expected/config_oldMatomoVersion.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
}
],
"isSteppedConfig": true
}
}
Loading

0 comments on commit d16543d

Please sign in to comment.