maestro/src/bridge/server.tls.test.ts
oss-sync 3b1645cc91
Some checks failed
CI / build-and-test (push) Has been cancelled
sync: update from private repo (d31b280)
2026-06-11 11:28:40 +00:00

27 lines
1.0 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { computeEffectiveSecureCookie, shouldWarnDoubleTls } from './server.js';
describe('computeEffectiveSecureCookie', () => {
it('is true when secure_cookie is on (proxy mode)', () => {
expect(computeEffectiveSecureCookie(true, false)).toBe(true);
});
it('is true when native TLS is on even if secure_cookie is off', () => {
expect(computeEffectiveSecureCookie(false, true)).toBe(true);
});
it('is false when neither', () => {
expect(computeEffectiveSecureCookie(false, false)).toBe(false);
});
});
describe('shouldWarnDoubleTls', () => {
it('warns when native TLS and secure_cookie (proxy signal) are both on', () => {
expect(shouldWarnDoubleTls(true, true)).toBe(true);
});
it('does not warn for a plain native-TLS install (secure_cookie off)', () => {
expect(shouldWarnDoubleTls(true, false)).toBe(false);
});
it('does not warn when TLS is disabled', () => {
expect(shouldWarnDoubleTls(false, true)).toBe(false);
});
});