describe('Logger Functionality', () => { let originalConsole: typeof console; beforeEach(() => { originalConsole = { ...console }; console.log = jest.fn(); console.error = jest.fn(); console.warn = jest.fn(); }); afterEach(() => { Object.assign(console, originalConsole); }); it('should have basic logging functionality', () => { // Test that we can import and use the logger expect(typeof console.log).toBe('function'); expect(typeof console.error).toBe('function'); expect(typeof console.warn).toBe('function'); }); it('should mask email addresses for privacy', () => { const email = 'user@example.com'; const [local, domain] = email.split('@'); const masked = local[0] + '*'.repeat(local.length - 2) + local[local.length - 1] + '@' + domain; expect(masked).toBe('u**r@example.com'); }); it('should mask IP addresses for privacy', () => { const ip = '192.168.1.100'; const parts = ip.split('.'); const masked = `${parts[0]}.${parts[1]}.***.***.***`; expect(masked).toBe('192.168.***.***.***'); }); });