import { AxiosWebClientService } from './webclient.service';

describe('AxiosWebClientService 로그 마스킹', () => {
  it('옥토버 연결 세션 header를 요청·응답 본문에서 숨긴다', () => {
    const service = new AxiosWebClientService();
    expect(
      (service as any).redactPII({
        in: { connHeader: 'request-secret' },
        out: { header: 'response-secret' },
      }),
    ).toEqual({ in: { connHeader: '***' }, out: { header: '***' } });
  });

  it('알림톡 자격증명·수신자·메시지를 숨긴다', () => {
    const service = new AxiosWebClientService();
    expect(
      (service as any).redactPII({
        apikey: 'secret',
        senderkey: 'secret',
        receiver_1: '01012345678',
        message_1: '고객 메시지',
        button_1: '{"linkMo":"https://example.test/token"}',
        subject_1: '보험유니버스',
      }),
    ).toEqual({
      apikey: '***',
      senderkey: '***',
      receiver_1: '***',
      message_1: '***',
      button_1: '***',
      subject_1: '보험유니버스',
    });
  });
});
