-
Notifications
You must be signed in to change notification settings - Fork 70
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
276 anonymous session #283
Conversation
This PR was built from #281, so make sense to review after that PR has been merged. |
a3d20ea
to
150e357
Compare
Codecov Report
@@ Coverage Diff @@
## master #283 +/- ##
========================================
+ Coverage 97.92% 98% +0.08%
========================================
Files 72 72
Lines 1590 1605 +15
Branches 350 354 +4
========================================
+ Hits 1557 1573 +16
+ Misses 27 26 -1
Partials 6 6
Continue to review full report at Codecov.
|
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.
left some nitpicks
const options = createTestOptions({ | ||
credentials: { | ||
clientId: 'yeah', | ||
clientSecret: 'yo', |
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.
- clientId: foo
- clientSecret: bar
const mockCred = { | ||
clientId: '123', | ||
clientSecret: 'secret', | ||
anonymousId: 'youdontknowme', |
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.
- clientId: foo
- clientSecret: bar
- anonymousId: baz
expect(buildRequestForAnonymousSessionFlow(options)).toEqual({ | ||
basicAuth: 'MTIzOnNlY3JldA==', | ||
url: 'http://localhost:8080/oauth/test/anonymous/token', | ||
body: oneLineTrim`grant_type=client_credentials& |
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.
use new lines to increase readability here?
) | ||
expect(actualParams.basicAuth).toBe('MTIzOnNlY3JldA==') | ||
expect(authMiddlewareBase).toHaveBeenCalledTimes(1) | ||
jest.unmock('../src/base-auth-flow') |
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.
shouldn't this be in an afterEach
or afterAll
?
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth ISSUES CLOSED: #212
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
150e357
to
ed81854
Compare
docs/sdk/api/sdkMiddlewareAuth.md
Outdated
|
||
1. `host` *(String)*: the host of the OAuth API service | ||
2. `projectKey` *(String)*: the key of the project to assign the default scope to | ||
3. `credentials` *(Object)*: the client credentials for authentication (`clientId`, `clientSecret`) |
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.
The customer username and password (the user
object) should also be part of the credentials
object
@@ -4,6 +4,9 @@ import { | |||
|
|||
import authMiddlewareBase from '../src/base-auth-flow' | |||
|
|||
// required to be at the root because Jest hoists it avoid all requires, |
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.
Do you mean above all requires
?
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
affects: @commercetools/sdk-middleware-auth
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.
👍
affects: @commercetools/sdk-middleware-auth
Summary
Fixes #276
Description
Todo