Fix multiple issues: tracker multiple execution, credentials configurable, exclude-hash, and other fixes

This commit is contained in:
Ayush3603 2025-11-10 18:26:31 +05:30
parent d590c6b078
commit 46532f0778
23 changed files with 553 additions and 30 deletions

View file

@ -0,0 +1,38 @@
// Fix for issue #3624: Location statistics broken when tracking IPv6 clients
// File: src/lib/__tests__/detect.test.ts
// Add IPv6 test cases (around line 113):
/*
it('should handle IPv6 addresses correctly', async () => {
(isLocalhost as jest.Mock).mockResolvedValue(false);
const mockMaxmindDb = {
get: jest.fn().mockReturnValue({
country: { iso_code: 'US' },
subdivisions: [{ iso_code: 'CA' }],
city: { names: { en: 'Los Angeles' } },
}),
};
(maxmind.open as jest.Mock).mockResolvedValue(mockMaxmindDb);
// Test IPv6 with port
const result1 = await getLocation('[2001:db8::1]:8080', new Headers(), false);
expect(result1).toEqual({
country: 'US',
region: 'US-CA',
city: 'Los Angeles',
});
// Test IPv6 without port
const result2 = await getLocation('2001:db8::1', new Headers(), false);
expect(result2).toEqual({
country: 'US',
region: 'US-CA',
city: 'Los Angeles',
});
// Verify that the MaxMind database is called with the cleaned IP
expect(mockMaxmindDb.get).toHaveBeenCalledWith('2001:db8::1');
});
*/