-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cookieDuration): add cookieDuration support #61
Conversation
2660d1f
to
044069d
Compare
const credentials = { | ||
apiKey: "test", | ||
applicationID: "test" | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was unsused.
I will check tslint config to make sure this doesn't occur more: #62
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved createUUID outside so I can mock it in the tests. It's generic enough that it can belong inside utils/index.ts
|
||
const cookieDuration = options.cookieDuration | ||
? options.cookieDuration | ||
: 6 * MONTH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by default cookieDuration is 6 months
|
||
describe("createUUID", () => { | ||
it("should return a string composed of valid hex characters or dashes `-`", () => { | ||
expect(createUUID()).toMatch(/^[0-9a-f\-]+$/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to test this more. We don't actually care that this is a valid uuid. What's important is that:
- it's random
- it contains only hex characters so that they don't get encoded when used in a cookie.
044069d
to
4368c2f
Compare
- remove cookie reuinitialization at each init - move createUUID outside cookie methods for easier testing - add tests for createUUID
4368c2f
to
babb1ad
Compare
This PR: