-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alban bertolini
authored and
alban bertolini
committed
Mar 8, 2024
1 parent
9ddd0db
commit c5c4a16
Showing
3 changed files
with
7 additions
and
10 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
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
const nock = require('nock'); | ||
const jwt = require('jsonwebtoken'); | ||
const ProjectSerializer = require('../../src/serializers/project'); | ||
const EnvironmentSerializer = require('../../src/serializers/environment'); | ||
const JobSerializer = require('../../src/serializers/job'); | ||
const { default: Agents } = require('../../src/utils/agents'); | ||
|
||
const SIGNED_JWT_TOKEN = | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDk5MDUwMTgsImV4cCI6MTcwOTk5MTQxOH0.EuQsuKhEGyEm4MXCZKMuFyk6V9bDM8wnrWcZ05mnp0c'; | ||
/** | ||
* @param {import('nock').Scope} nockScope | ||
*/ | ||
|
@@ -146,7 +147,7 @@ function authenticationSucceeded(scope) { | |
'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code&device_code=DEVICE-CODE&client_id=the-client-id', | ||
) | ||
.reply(200, { | ||
access_token: jwt.sign({}, 'key', { expiresIn: '1day' }), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
access_token: SIGNED_JWT_TOKEN, | ||
}); | ||
} | ||
|
||
|
@@ -169,7 +170,7 @@ function createAuthenticationToken(scope) { | |
data: { | ||
id: 42, | ||
attributes: { | ||
token: jwt.sign({}, 'key', { expiresIn: '1day' }), | ||
token: SIGNED_JWT_TOKEN, | ||
}, | ||
}, | ||
}); | ||
|
@@ -203,7 +204,9 @@ module.exports = { | |
loginValid: () => | ||
nock('http://localhost:3001') | ||
.post('/api/sessions', { email: '[email protected]', password: 'valid_pwd' }) | ||
.reply(200, { token: jwt.sign({}, 'key', { expiresIn: '1day' }) }), | ||
.reply(200, { | ||
token: SIGNED_JWT_TOKEN, | ||
}), | ||
|
||
loginInvalid: () => | ||
nock('http://localhost:3001') | ||
|
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 |
---|---|---|
|
@@ -8065,11 +8065,6 @@ jws@^4.0.0: | |
jwa "^2.0.0" | ||
safe-buffer "^5.0.1" | ||
|
||
[email protected]: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-2.2.0.tgz#7d86bd56679f58ce6a84704a657dd392bba81a79" | ||
integrity sha512-86GgN2vzfUu7m9Wcj63iUkuDzFNYFVmjeDm2GzWpUk+opB0pEpMsw6ePCMrhYkumz2C1ihqtZzOMAg7FiXcNoQ== | ||
|
||
keytar@^7.3.0: | ||
version "7.9.0" | ||
resolved "https://registry.yarnpkg.com/keytar/-/keytar-7.9.0.tgz#4c6225708f51b50cbf77c5aae81721964c2918cb" | ||
|
How can your token expires in 1 day? 😲