Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
corbadoman committed Oct 2, 2024
1 parent 192a90c commit 2ca58dd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/unit/session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Session Service Unit Tests', () => {
);
});

test('should throw ValidationError if short session is empty', async () => {
test('should throw ValidationError if JWT is empty', async () => {
const sessionService = createSessionService('https://pro-1.frontendapi.cloud.corbado.io')

await expect(sessionService.validateToken('')).rejects.toThrow(BaseError);
Expand All @@ -105,7 +105,7 @@ describe('Session Service Unit Tests', () => {
);
});

test('should throw ValidationError if short session is too short', async () => {
test('should throw ValidationError if JWT is too short', async () => {
const sessionService = createSessionService('https://pro-1.frontendapi.cloud.corbado.io')

await expect(sessionService.validateToken('short')).rejects.toThrow(ValidationError);
Expand All @@ -115,12 +115,12 @@ describe('Session Service Unit Tests', () => {
);
});

test('should throw ValidationError if jwt has an invalid signature', async () => {
test('should throw ValidationError if JWT has an invalid signature', async () => {
const sessionService = createSessionService('https://pro-1.frontendapi.cloud.corbado.io')

const shortSession = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImtpZDEyMyJ9.eyJpc3MiOiJodHRwczovL2F1dGguYWNtZS5jb20iLCJpYXQiOjE3MjY0OTE4MDcsImV4cCI6MTcyNjQ5MTkwNywibmJmIjoxNzI2NDkxNzA3LCJzdWIiOiJ1c3ItMTIzNDU2Nzg5MCIsIm5hbWUiOiJuYW1lIiwiZW1haWwiOiJlbWFpbCIsInBob25lX251bWJlciI6InBob25lTnVtYmVyIiwib3JpZyI6Im9yaWcifQ.invalid';
await expect(sessionService.validateToken(shortSession)).rejects.toThrow(ValidationError);
await expect(sessionService.validateToken(shortSession)).rejects.toHaveProperty(
const jwt = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImtpZDEyMyJ9.eyJpc3MiOiJodHRwczovL2F1dGguYWNtZS5jb20iLCJpYXQiOjE3MjY0OTE4MDcsImV4cCI6MTcyNjQ5MTkwNywibmJmIjoxNzI2NDkxNzA3LCJzdWIiOiJ1c3ItMTIzNDU2Nzg5MCIsIm5hbWUiOiJuYW1lIiwiZW1haWwiOiJlbWFpbCIsInBob25lX251bWJlciI6InBob25lTnVtYmVyIiwib3JpZyI6Im9yaWcifQ.invalid';
await expect(sessionService.validateToken(jwt)).rejects.toThrow(ValidationError);
await expect(sessionService.validateToken(jwt)).rejects.toHaveProperty(
'name',
ValidationErrorNames.JWTInvalid,
);
Expand Down

0 comments on commit 2ca58dd

Please sign in to comment.