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", 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', });