Skip to content

Commit 0403071

Browse files
committed
chore: upgrade auth test
1 parent e4f9e5d commit 0403071

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

samples/test/test.samples.auth.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ describe('Auth samples', () => {
3131
nock.cleanAll();
3232
});
3333

34-
it('should support JWT', async () => {
35-
const scope = nock('https://www.googleapis.com')
34+
it.only('should support JWT', async () => {
35+
const scopes = [nock('https://www.googleapis.com')
3636
.get('/drive/v2/files')
37-
.reply(200, {})
38-
.post('/oauth2/v4/token')
39-
.reply(200, {access_token: 'not-a-token'});
37+
.reply(200, {}),
38+
nock('https://oauth2.googleapis.com/')
39+
.post('/token')
40+
.reply(200, {access_token: 'not-a-token'})]
4041
const fakePath = path.resolve('../test/fixtures/service.json');
4142
const realPath = path.resolve('jwt.keys.json');
4243
const exists = fs.existsSync(realPath);
@@ -46,15 +47,15 @@ describe('Auth samples', () => {
4647
}
4748
const data = await samples.jwt.runSample();
4849
assert(data);
49-
scope.done();
50+
scopes.forEach(scope => scope.done());
5051
});
5152

5253
it('should accept an access token header', async () => {
5354
const scope = nock('https://www.googleapis.com')
5455
.get('/drive/v2/files')
5556
.reply(200, {});
5657
const res = await samples.accessToken.runSample(12345);
57-
assert.strictEqual(res.config.headers['Authorization'], 'Bearer 12345');
58+
assert.strictEqual(res.config.headers.get('Authorization'), 'Bearer 12345');
5859
scope.done();
5960
});
6061
});

0 commit comments

Comments
 (0)