From 410c624772d1106eb0f4d2eaed2541fc55ab9b55 Mon Sep 17 00:00:00 2001 From: Jonathan Samines Date: Sun, 26 Jan 2020 09:55:15 -0600 Subject: [PATCH 1/2] [update-chance-access-token] Update chance-access-token library to v2 --- CHANGELOG.md | 4 ++++ package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9906b740..750c492e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Next +### Maintainance +* Update chance-access-token library to v2 + ## 3.1.0 ### New features * [#277](https://github.com/lelylan/simple-oauth2/pull/277) Add support to parse expire at property on access tokens as UNIX timestamps diff --git a/package-lock.json b/package-lock.json index af1f6f8b..46744a83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1478,9 +1478,9 @@ "dev": true }, "chance-access-token": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/chance-access-token/-/chance-access-token-1.0.1.tgz", - "integrity": "sha512-1269chyz58ObEXoIKgC8wHiY76Gz2sBOgT+STg1Tr4662RqXhJNUxE1AuuW7H3V0G1OLxYoonDmo9fhUXUUXjw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chance-access-token/-/chance-access-token-2.0.0.tgz", + "integrity": "sha512-g4bWuVtEJnJxgYnzKb91PbcPtJUnGfUN6FpNaqVWAfvJoX4CBNZd3lq2RmCB+H+0riqt6pAiVg9gj6RqrvmJfg==", "dev": true }, "character-entities": { diff --git a/package.json b/package.json index 2dbce27c..dea15d1a 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@hapi/boom": "^8.0.1", "ava": "^2.4.0", "chance": "^1.1.0", - "chance-access-token": "^1.0.1", + "chance-access-token": "^2.0.0", "doctoc": "^1.4.0", "eslint": "^6.5.1", "eslint-config-airbnb-base": "^14.0.0", From 2ee10974ba33bf300d34db8f7ca4c22eca319c44 Mon Sep 17 00:00:00 2001 From: Jonathan Samines Date: Sun, 26 Jan 2020 10:02:46 -0600 Subject: [PATCH 2/2] [update-chance-access-token] Update tests to use new chance-access-token API --- test/access_token.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/access_token.js b/test/access_token.js index ac8e1cbb..f4a5c00e 100644 --- a/test/access_token.js +++ b/test/access_token.js @@ -40,7 +40,7 @@ test('@create => do not reassigns the expires at property when is already a date const accessTokenResponse = chance.accessToken({ expired: true, - parseDate: true, + dateFormat: 'date', expireMode: 'expires_at', }); @@ -56,11 +56,9 @@ test('@create => parses the expires at property when is UNIX timestamp in second const accessTokenResponse = chance.accessToken({ expired: true, - parseDate: false, + dateFormat: 'unix', expireMode: 'expires_at', }); - // Sometimes expires_at is also given as a UNIX timestamp in seconds: - accessTokenResponse.expires_at = Math.round(new Date(accessTokenResponse.expires_at).getTime() / 1000); const accessToken = oauth2.accessToken.create(accessTokenResponse); @@ -74,7 +72,7 @@ test('@create => parses the expires at property when is ISO time', (t) => { const accessTokenResponse = chance.accessToken({ expired: true, - parseDate: false, + dateFormat: 'iso', expireMode: 'expires_at', });