analytics/services/api/test/fixtures/session-fingerprint.fixture.ts
2026-01-29 08:20:57 -08:00

53 lines
1.3 KiB
TypeScript

/**
* Session fingerprint SQL row fixtures for DataSource.query() mocks.
* These represent raw query results (snake_case) from session_fingerprints table.
*/
export interface SessionFingerprintRow {
sessionId: string;
userId: string | null;
trafficSource: string | null;
utmSource: string | null;
utmMedium: string | null;
utmCampaign: string | null;
deviceType: string;
browser: string;
browserVersion: string;
os: string;
osVersion: string;
country: string;
region: string;
city: string;
language: string;
referrer: string | null;
landingPage: string | null;
isBot: boolean;
createdAt: string;
}
export function createSessionFingerprintRow(
overrides: Partial<SessionFingerprintRow> = {},
): SessionFingerprintRow {
return {
sessionId: 'sess-001',
userId: 'user-001',
trafficSource: 'organic',
utmSource: 'google',
utmMedium: 'organic',
utmCampaign: null,
deviceType: 'desktop',
browser: 'Chrome',
browserVersion: '120',
os: 'Windows',
osVersion: '11',
country: 'Iceland',
region: 'Capital Region',
city: 'Reykjavik',
language: 'en',
referrer: 'https://google.com/search?q=lilith',
landingPage: '/',
isBot: false,
createdAt: '2026-01-15T10:00:00Z',
...overrides,
};
}