Convert TokenModel to an ES6 class and extract utils function for calculating lifetime #223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I saw open issue #212 for converting ES5-style classes to modern class syntax, and it seemed like a nice issue for new contributors to help chip away at (small refactoring that can be covered by unit tests; no functional changes).
So, I am submitting a PR to do that for the
TokenModel
class. Hopefully it is helpful! I'm happy to make changes to better match the desired styles/conventions of the repo as necessary. Or, if this PR isn't in line with what you had in mind, I won't be offended if you'd prefer to close it.Overview:
TokenModel
to an ES6-style class (previously it was an ES5-style "constructor function").date-util
module.Linked issue(s)
One checkbox of #212 (but not the whole thing).
Involved parts of the project
Specifically the
TokenModel
, which is used as a representation for access/refresh tokens.Added tests?
Although I did not make functional changes, I did add a couple of new test cases to make absolutely sure there weren't regressions.
token-model__test.js
to make sure that the model constructor is continuing to work as expected, especially when required arguments are missing, or when custom attributes are passed in.date-util__test.js
) to specifically cover the extracted utility function.OAuth2 standard
N/A
Reproduction
N/A