This repository has been archived by the owner on Dec 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: resolved merge conflicts with handlers
- Loading branch information
Showing
3 changed files
with
139 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const imgur = require('../lib/imgur.js'); | ||
|
||
afterEach(imgur.clearAllCredentials); | ||
|
||
test('returns provided access code in bearer header', async () => { | ||
const accessToken = 'abc123'; | ||
const imgur = require('../lib/imgur.js'); | ||
imgur.setAccessToken(accessToken); | ||
const authorizationHeader = await imgur._getAuthorizationHeader(); | ||
expect(authorizationHeader).toBe(`Bearer ${accessToken}`); | ||
}); | ||
|
||
test('returns provided client id in client id header', async () => { | ||
const clientId = 'abc123'; | ||
imgur.setClientId(clientId); | ||
const authorizationHeader = await imgur._getAuthorizationHeader(); | ||
expect(authorizationHeader).toBe(`Client-ID ${clientId}`); | ||
}); | ||
|
||
test.only('retrieves access token from imgur via provided username/password/clientid', async () => { | ||
imgur.setCredentials('fakeusername', 'fakepassword', 'fakeclientd'); | ||
const authorizationHeader = await imgur._getAuthorizationHeader(); | ||
expect(authorizationHeader).toMatchInlineSnapshot( | ||
`"Bearer 123accesstoken456"` | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters