Spaces:
Configuration error
Configuration error
Download src/lib/__tests__/detect.test.ts from SreejithSHR/umami: direct link, hf CLI and curl.
- Browser
- Download file 699 Bytes
-
https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/lib/__tests__/detect.test.ts
- Command line
-
hf download hf://spaces/SreejithSHR/umami/src/lib/__tests__/detect.test.ts
-
curl -L -o detect.test.ts https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/lib/__tests__/detect.test.ts
699 Bytes
| import * as detect from '../detect'; | |
| import { expect } from '@jest/globals'; | |
| const IP = '127.0.0.1'; | |
| test('getIpAddress: Custom header', () => { | |
| process.env.CLIENT_IP_HEADER = 'x-custom-ip-header'; | |
| expect(detect.getIpAddress({ headers: { 'x-custom-ip-header': IP } } as any)).toEqual(IP); | |
| }); | |
| test('getIpAddress: CloudFlare header', () => { | |
| expect(detect.getIpAddress({ headers: { 'cf-connecting-ip': IP } } as any)).toEqual(IP); | |
| }); | |
| test('getIpAddress: Standard header', () => { | |
| expect(detect.getIpAddress({ headers: { 'x-forwarded-for': IP } } as any)).toEqual(IP); | |
| }); | |
| test('getIpAddress: No header', () => { | |
| expect(detect.getIpAddress({ headers: {} } as any)).toEqual(null); | |
| }); | |