Skip to content

Commit

Permalink
test: add asserts on authorize (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and ofrobots committed Jan 8, 2018
1 parent 99b26dd commit af01878
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/test.jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,17 @@ describe('JWT auth client', () => {
['http://bar', 'http://foo'], 'bar@subjectaccount.com');

createGTokenMock();
jwt.authorize(() => {
jwt.authorize((err, creds) => {
assert.equal(err, null);
assert.notEqual(creds, null);
assert.equal('foo@serviceaccount.com', jwt.gtoken.iss);
assert.equal(PEM_PATH, jwt.gtoken.keyFile);
assert.equal(['http://bar', 'http://foo'].join(' '), jwt.gtoken.scope);
assert.equal('bar@subjectaccount.com', jwt.gtoken.sub);
assert.equal('initial-access-token', jwt.credentials.access_token);
assert.equal(creds!.access_token, jwt.credentials.access_token);
assert.equal(creds!.refresh_token, jwt.credentials.refresh_token);
assert.equal(creds!.token_type, jwt.credentials.token_type);
assert.equal('jwt-placeholder', jwt.credentials.refresh_token);
assert.equal(PEM_CONTENTS, jwt.key);
assert.equal('foo@serviceaccount.com', jwt.email);
Expand Down

0 comments on commit af01878

Please sign in to comment.