Skip to content

Commit

Permalink
test: ensure params are not deleted from global options
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed May 28, 2020
1 parent 46ac8ba commit dca2aa2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/test.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,19 @@ describe('Options', () => {
});

it('should use the same per-API setting twice', async () => {
const google = new GoogleApis();
google.options({auth: 'apikey1'});
const drive = google.drive({version: 'v2', auth: 'apikey2'});
const scope = nock(Utils.baseUrl)
.get('/drive/v2/files/woot?key=apikey3')
.get('/gmail/v1/users/me/labels')
.twice()
.reply(200);
for (let i = 0; i < 2; i++) {
const res = await drive.files.get({auth: 'apikey3', fileId: 'woot'});
assert.strictEqual(Utils.getQs(res), 'key=apikey3');
}
const google = new GoogleApis();
const gmail = google.gmail({
version: 'v1',
params: {
userId: 'me',
},
});
await gmail.users.labels.list();
await gmail.users.labels.list();
scope.done();
});

Expand Down

0 comments on commit dca2aa2

Please sign in to comment.