Skip to content

Commit 3e3588c

Browse files
committed
fix: const declarations
1 parent 9769b9f commit 3e3588c

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/features/twitter/controllers/twitter-controller.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,17 @@ describe('[Controller] Twitter', () => {
7272
describe('login', () => {
7373
it('return URLs when the token is valid', async () => {
7474
const { authController, next, req, res } = makeSut();
75-
76-
req.headers.authorization =
77-
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJ1c2VySWQiOiIxMjM0NSIsInVzZXJuYW1lIjoiam9obmRvZSIsImlhdCI6MTY2NTMzMjM0NCwiZXhwIjoxNjY1MzM1OTQ0fQ.S5ReMBrQqVAD6UCD6Q9Vj9fK9J-Q9r_a9f3zRmpDsxM';
78-
7975
const mockPayload = {
8076
name: 'John Doe',
8177
userId: '12345',
8278
username: 'johndoe',
8379
};
84-
85-
vi.spyOn(jwt, 'verify').mockReturnValue(mockPayload as any);
80+
const expectedUrl = `https://twitter.com/i/oauth2/authorize?client_id=mockClientId123&code_challenge=-a4-ROPIVaUBVj1qqB2O6eN_qSC0WvET0EdUEhSFqrI&code_challenge_method=S256&redirect_uri=http%3A%2F%2Fwww.localhost%3A3000%2Fapi%2Ftwitter%2Fcallback&response_type=code&state=${mockPayload.userId}&scope=tweet.write%20tweet.read%20users.read`;
8681
process.env.TWITTER_CLIENT_ID = 'mockClientId123';
82+
req.headers.authorization =
83+
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJ1c2VySWQiOiIxMjM0NSIsInVzZXJuYW1lIjoiam9obmRvZSIsImlhdCI6MTY2NTMzMjM0NCwiZXhwIjoxNjY1MzM1OTQ0fQ.S5ReMBrQqVAD6UCD6Q9Vj9fK9J-Q9r_a9f3zRmpDsxM';
8784

88-
const expectedUrl = `https://twitter.com/i/oauth2/authorize?client_id=mockClientId123&code_challenge=-a4-ROPIVaUBVj1qqB2O6eN_qSC0WvET0EdUEhSFqrI&code_challenge_method=S256&redirect_uri=http%3A%2F%2Fwww.localhost%3A3000%2Fapi%2Ftwitter%2Fcallback&response_type=code&state=${mockPayload.userId}&scope=tweet.write%20tweet.read%20users.read`;
85+
vi.spyOn(jwt, 'verify').mockReturnValue(mockPayload as any);
8986

9087
await authController.login(req, res, next);
9188

0 commit comments

Comments
 (0)