init
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user