-
Notifications
You must be signed in to change notification settings - Fork 64
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
Refactor Jira OnPrem OAuth to add unit tests #622
base: main
Are you sure you want to change the base?
Conversation
return parameter.startsWith("oauth_"); | ||
} | ||
|
||
export const makeArrayOfArgumentsHash = (argumentsHash: Map<string, string | string[]>): [string, string][] => { |
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.
Not sure why this is Map<string, string | string[]>
instead of Map<string, string>
.
Issue #621
This was an issue before and I didn't remove the support for string[]
.
Please let's not make that a blocker for this PR.
mockServerResponse = { | ||
oauth_token: "abc", | ||
oauth_token_secret: "def", | ||
}; | ||
const actual = await jiraOAuth.exchangeRequestForToken("foo", "bar"); |
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.
If mocha runs the tests in parallel, this is a race condition with the other tests.
redirect_uri: "https://redirect", | ||
}; | ||
// This private key is ONLY used for testing. It's safe to be published. | ||
const privateKey = `-----BEGIN PRIVATE KEY----- |
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.
GitHub key scanner report coming in 10... 9... 8... 7...
As mentioned in the comment, I generated this key just for testing.
OnPremOAuth.ts
.OnPremOAuth.ts
to be simpler, safer and more testable.Tip for reviewing: Pretend that this is new code – comparing it to the old code has become increasingly difficult. Test it with a Jira instance.