Skip to content

Commit

Permalink
disable secure cookies in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Mar 5, 2024
1 parent 3d5977c commit da3eef6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createHash } from 'crypto';
import { JsonWebTokenError, TokenExpiredError, type JwtPayload } from 'jsonwebtoken';

import config from '@/config';
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants';
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time, inTest } from '@/constants';
import type { User } from '@db/entities/User';
import { UserRepository } from '@db/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error';
Expand Down Expand Up @@ -79,7 +79,7 @@ export class AuthService {
maxAge: this.jwtExpiration * Time.seconds.toMilliseconds,
httpOnly: true,
sameSite: 'lax',
secure: true,
secure: !inTest,
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/unit/auth/auth.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('AuthService', () => {
httpOnly: true,
maxAge: 604800000,
sameSite: 'lax',
secure: true,
secure: false,
});
});
});
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('AuthService', () => {
httpOnly: true,
maxAge: 604800000,
sameSite: 'lax',
secure: true,
secure: false,
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/unit/controllers/me.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('MeController', () => {
maxAge: expect.any(Number),
httpOnly: true,
sameSite: 'lax',
secure: true,
secure: false,
}),
);

Expand Down Expand Up @@ -188,7 +188,7 @@ describe('MeController', () => {
maxAge: expect.any(Number),
httpOnly: true,
sameSite: 'lax',
secure: true,
secure: false,
}),
);

Expand Down

0 comments on commit da3eef6

Please sign in to comment.