This commit is contained in:
2026-08-28 17:31:02 +02:00
commit 2b30e8bd39
694 changed files with 49243 additions and 0 deletions
@@ -0,0 +1,24 @@
import { SHOP_SURFACE_HEADER_NAME } from '../consts/shopSurfaceHeader';
import { NodeEnv } from '../types/NodeEnv';
import { ShopSurface } from '../types/ShopSurface';
import { shouldUseSecureCookie } from './shouldUseSecureCookie';
describe('shouldUseSecureCookie', () => {
it('returns true only for production clearnet requests', () => {
const req = { headers: { [SHOP_SURFACE_HEADER_NAME]: ShopSurface.Clearnet } };
expect(shouldUseSecureCookie(NodeEnv.Production, req)).toBe(true);
});
it('returns false for production onion requests', () => {
const req = { headers: { [SHOP_SURFACE_HEADER_NAME]: ShopSurface.Onion } };
expect(shouldUseSecureCookie(NodeEnv.Production, req)).toBe(false);
});
it('returns false outside production', () => {
const req = { headers: { [SHOP_SURFACE_HEADER_NAME]: ShopSurface.Clearnet } };
expect(shouldUseSecureCookie(NodeEnv.Development, req)).toBe(false);
});
});