ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/llms-txt-hub / apps/web/app/api/csrf/__tests__/route.test.ts

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/llms-txt-hub / apps/web/app/api/csrf/__tests__/route.test.ts
DateNot specified in source
RepositoryJanady13/llms-txt-hub
Revisione0f4bf978d4df168369c7601d9c5f5ea89e84377
Branchmain
Path or archive memberapps/web/app/api/csrf/__tests__/route.test.ts
Original SHA-256c200f2eeebf173aef1d71a358bc7ea6c502f7ac8cc94e3bf615aef0f7225e059
Git blob SHA6aea1f60c8cdf73df7d80444002b25b21c4a94ed
Reading-copy SHA-256c200f2eeebf173aef1d71a358bc7ea6c502f7ac8cc94e3bf615aef0f7225e059

Original source ↗

Recovered source transcript

import { generateCSRFToken } from '@/lib/csrf-protection' // Mock dependencies that are causing issues in the test environment jest.mock('next/headers', () => ({ cookies: jest.fn().mockResolvedValue({ set: jest.fn() }) })) jest.mock('@thedaviddias/logging', () => ({ logger: { info: jest.fn(), warn: jest.fn(), error: jest.fn() } })) jest.mock('@/lib/server-crypto', () => ({ hashSensitiveData: jest.fn().mockReturnValue('hashed-data') })) describe('/api/csrf', () => { describe('generateCSRFToken', () => { it('should generate a random hex token', () => { const token = generateCSRFToken() expect(typeof token).toBe('string') expect(token.length).toBe(64) // 32 bytes = 64 hex chars expect(token).toMatch(/^[a-f0-9]{64}$/i) }) it('should generate different tokens on subsequent calls', () => { const token1 = generateCSRFToken() const token2 = generateCSRFToken() expect(token1).not.toBe(token2) }) }) describe('CSRF API route behavior', () => { it('should have the correct route structure', async () => { // Import the route handler const { GET } = await import('@/app/api/csrf/route') // Verify it's a function expect(typeof GET).toBe('function') // The route should handle GET requests expect(GET.name).toBe('GET') }) }) })

Search equations, builds, manuscript text, and recovered sources.