repo
stringclasses
20 values
path
stringlengths
6
94
lang
stringclasses
5 values
n_chars
int64
81
200k
sha256
stringlengths
64
64
content
stringlengths
81
200k
eren23/non_linear_ai_chat
frontend/src/lib/fileUploadDedup.ts
ts
2,236
5e915404b2b2c57693b3424752ab82f3da1923a92e1cbb3995dbed07a690ea18
/** * fileUploadDedup - Prevents duplicate file uploads to the same node. * * Uses a module-level cache: Map<nodeId, Map<fingerprint, timeoutId>> * Fingerprints are based on file name, size, and lastModified timestamp. */ /** Map<nodeId, Map<fingerprint, timeoutId>> */ const cache = new Map<string, Map<string, Re...
eren23/non_linear_ai_chat
frontend/src/lib/knowledgeGraphUtils.ts
ts
374
2922ec91cca85c2e31267c1aebd613a6f2a5b1da3cc4485fdc24b2585c8aaed9
/** * Shared utilities for the knowledge graph feature. */ /** Returns a type-prefixed ID string for a knowledge item (e.g. "note-abc", "capture-xyz", "doc-123"). */ export function getPrefixedId(item: { kind: string; id: string }): string { const prefix = item.kind === 'note' ? 'note' : item.kind === 'capture' ? ...
eren23/non_linear_ai_chat
frontend/src/lib/index.ts
ts
547
bc7b52331eaa159f0bd3eebafbae5916871589eeebac88cda770d583c3259a1f
/** * Library Barrel Export * * Main entry point for all lib utilities and API clients. * * Usage: * import { API_BASE, apiFetch } from '@/lib/csrfApi'; * import { flowsApi, memoriesApi } from '@/lib/api'; */ // API clients are available via @/lib/api // This file provides utilities and shared helpers e...
eren23/non_linear_ai_chat
frontend/src/lib/audioApi.ts
ts
1,134
5d2508c603992fc6c821aacff1f8c3105cb2844461c5ead4643dda451e264de8
/** * Audio API client for speech-to-text transcription. */ import { apiFetch } from '@/lib/csrfApi'; export interface TranscriptionResult { text: string; confidence: number; language: string; processingTime: number; isHighQuality: boolean; warning?: string; } export interface TranscriptionError { er...
eren23/non_linear_ai_chat
frontend/src/lib/graphTheme.ts
ts
2,260
eda81444ef9d597048bb651a229ca6826849fe004e68df1acf53d22ce3c338bc
/** * Centralized Graph Theme * * Single source of truth for all graph visualization colors. * Bridges the dark theme (#1a1a2e background) with distinct, accessible hues. */ export const MEMORY_NODE_COLORS: Record<string, string> = { conversation: '#7C8CF8', // Soft indigo note: '#E879A8', // Muted ro...
eren23/non_linear_ai_chat
frontend/src/lib/formatters.ts
ts
1,163
4c8833eb0072070aab909302c720c2731aac5c99f011b89503a040b9f30e0711
/** * Shared formatting utilities. */ /** Format milliseconds into a human-readable duration string. */ export function formatDuration(ms: number): string { if (ms < 1000) return `${ms}ms`; const totalSeconds = Math.floor(ms / 1000); const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor((...
eren23/non_linear_ai_chat
frontend/src/lib/tasksApi.ts
ts
2,399
5eda83188c3dbf26cec5517f5c3fb42523a8a3429b2bc129b8d5eb234d62ea88
/** * API client for background task management. * * Extracted from filesApi.ts β€” tasks are not file-specific * and are shared across upload pipelines (files, documents, OCR). */ import { apiFetch } from '@/lib/csrfApi'; export interface TaskInfo { _id: string; type: 'file_upload' | 'library_upload' | 'ocr_t...
eren23/non_linear_ai_chat
frontend/src/lib/models.ts
ts
2,942
c6d899d7aca537e18e3170f3c7bf2e7e1d057378bccbb862d8c524b5b1e79011
/** * Model utilities for frontend. * * Models are fetched dynamically from the API (/api/init). * This file provides helper functions and a minimal fallback list. */ import type { ModelInfo, ProviderFamily } from '@/types/graph'; /** * Default model ID used when no model is specified. */ export const DEFAULT_...
eren23/non_linear_ai_chat
frontend/src/lib/onboardingTemplates.ts
ts
2,661
d3d9ef5ad171e5841c373e7bdd3fd0de6b11e44e556fdde7b401fc773b153d92
import type { GraphEdge, GraphNode, NodeData, InformationNodeData } from '@/types/graph' import { DEFAULT_MODEL } from '@/lib/models' export function getOnboardingTemplate(options: { templateId: 'branch-stale-synthesis' }): { flowName: string nodes: GraphNode[] edges: GraphEdge[] } { if (options.templateId !==...
eren23/non_linear_ai_chat
frontend/src/lib/revisionsApi.ts
ts
2,175
80fdcf67384b3f930ff0026c79007288b15a9b7202ce0779f7a751e895808969
import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export type RevisionEntityType = 'chat_node' | 'info_node' | 'note' | 'memory'; export type RevisionField = 'content' | 'prompt'; export type RevisionSource = | 'mcp' | 'agent' | 'telegram' | 'extension' | 'api' | 'ui' | 'system'; expor...
eren23/non_linear_ai_chat
frontend/src/lib/config.ts
ts
495
dc0d138028834489824eb5a1324ebd5415701debe7e42c6bcc07104dd4b4deca
/** * Frontend configuration and feature flags. * * Feature flags are read from environment variables with VITE_ prefix. * Default values are used when not set. */ /** * Application environment. */ export const APP_ENV = import.meta.env.VITE_ENVIRONMENT || import.meta.env.MODE || 'development'; /** * Is produ...
eren23/non_linear_ai_chat
frontend/src/lib/apiCache.ts
ts
9,036
3fe6a0fa3777cdd17eee526fb994cdf1963ecb2802d6b4c6958c3a533a239a13
/** * API Cache Layer with TTL, Stale-While-Revalidate, and Request Deduplication. * * Reduces redundant API calls by: * 1. Caching responses with configurable TTL * 2. Serving stale data while revalidating in background * 3. Deduplicating concurrent requests to same endpoint * * Usage: * ```typescript * // W...
eren23/non_linear_ai_chat
frontend/src/lib/apiTokensApi.ts
ts
1,770
3bb3524a93cfb5264d6418e364f867b076f1bd010347379df2b70ac703f4f2a0
/** * API Tokens API client. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface ApiToken { id: string; name: string; scopes: string[]; createdAt: string; lastUsedAt?: string; expiresAt?: string; isExpired: boolean; } export interface GenerateTokenResponse { toke...
eren23/non_linear_ai_chat
frontend/src/lib/toolsApi.ts
ts
2,432
6212ee0c84feb145f7f12a3c57b4b1681ed147eaabb5259d150fe09f5cc92047
/** * Tools API service. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface Tool { name: string; description: string; params: Record<string, { type: string; description?: string; required?: boolean; }>; enabled: boolean; } export interface ToolsResponse { ...
eren23/non_linear_ai_chat
frontend/src/lib/feedbackApi.ts
ts
3,849
17eed6f80446c683687d6106dbaa2fa78264d1e29634bab6e5828ef4734cc58a
/** * Feedback API * * API functions for submitting and retrieving human feedback on LLM responses. * Integrates with the backend evaluation framework for quality tracking. */ import { API_BASE } from './api'; import { apiFetch } from '@/lib/csrfApi'; export type FeedbackRating = 'positive' | 'negative'; export...
eren23/non_linear_ai_chat
frontend/src/lib/informationApi.ts
ts
4,283
9bcbc7b3f47283a5f49a07d42efa42635bcf723efc39b0d368f690ef8460cb88
/** * API client for information/source node features. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface FetchedContent { title: string; summary: string; // Preview/summary of the content content: string; // Full markdown content (unfiltered, clean, structured) contentL...
eren23/non_linear_ai_chat
frontend/src/lib/documentsApi.ts
ts
8,045
fcd9648983b42dc2d4b639390bd25c6b3dcb17fb0c87b323f22170dbecec4976
/** * API client for unified document management. * * Wraps the /api/documents/* endpoints. All uploads go to the library; * flow/node attachments are lightweight references (document_refs). */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = import.meta.env.VITE_API_BASE_URL || '/api'; export interfa...
eren23/non_linear_ai_chat
frontend/src/lib/calendarApi.ts
ts
6,173
6e8c1c5dfe234c2c05470b5fa17569434a8db1a55a8c38051f28e261f868fbf9
/** * Calendar API client. */ import { apiFetch } from '@/lib/csrfApi'; const API_BASE = '/api'; export interface CalendarConnection { provider: 'google' | 'microsoft'; email: string; connectedAt: string; isExpired: boolean; } export interface CalendarStatus { google: CalendarConnection | null; micros...
eren23/non_linear_ai_chat
frontend/src/lib/knowledgeGraphApi.ts
ts
8,109
7bfb8e7f77ba499901c61668eef8bba6604b695f33308abb8c723b49acb10d72
/** * Knowledge Graph API β€” unified types and fetching for Notes, Captures, and Documents. */ import type { Note } from './notesApi'; import type { MemoryGraph } from './memoryGraphApi'; const API_BASE = '/api'; // ─── Content type discriminator ─── export type KnowledgeContentType = 'notes' | 'captures' | 'docum...
eren23/non_linear_ai_chat
frontend/src/lib/attachmentsApi.ts
ts
6,550
a3c84d72beae263b74391a6e40f2b54898885bfef3f9c56ad152980ab1445340
/** * Attachments API Client * * Convenience layer for node attachments, wrapping the filesApi with * attachment-specific functionality like progress polling and status tracking. */ import { uploadFile, getNodeFiles, attachFileToNode, detachFileFromNode, getFile, type FileInfo, type UploadTaskRespon...
eren23/non_linear_ai_chat
frontend/src/lib/usePrompt.ts
ts
1,241
cfbbbdc1d0e3f8d59358bad355668504d897cf20ffe358e1a9dff776cd016ac3
/** * Hook for prompt dialogs - Replaces prompt() calls */ import { useState, useCallback } from 'react'; export interface PromptOptions { title: string; message: string; placeholder?: string; defaultValue?: string; confirmText?: string; cancelText?: string; type?: 'text' | 'textarea'; required?: bo...
eren23/non_linear_ai_chat
frontend/src/lib/cronApi.ts
ts
2,932
90a5d2af4c9542a3c1105d5fac23644aca36f55668afa0c02a04e9f42ee32eff
/** * API client for cron job reporting endpoints. */ const API_BASE = '/api/admin/cron'; const HISTORY_LIMIT_DEFAULT = 50; const HISTORY_LIMIT_MIN = 1; const HISTORY_LIMIT_MAX = 500; export type CronRunStatus = 'started' | 'completed' | 'failed'; export interface CronApiError extends Error { status: number; re...
eren23/non_linear_ai_chat
frontend/src/lib/caretPosition.ts
ts
2,289
4941cb368171f890075bfbe23ed047f0e46a75b6cb7c3ec7447dbe77caccedbb
/** * Shared utility for measuring caret position in a textarea. * Creates a mirror div to accurately compute pixel coordinates. */ /** * Get the pixel position of a caret position in a textarea. * Returns coordinates relative to the viewport. */ export function getCaretCoordinates( textarea: HTMLTextAreaEleme...
eren23/non_linear_ai_chat
frontend/src/lib/pollingUtils.ts
ts
3,003
f12b813bf5a5279e47cc809b56a164a6e4ea3008a4ebe429631e0c6b5943aaed
/** * Smart polling with exponential backoff on failure. * * On success: reset to baseInterval. * On failure: double interval up to maxInterval. * On consecutive failures (>= maxConsecutiveFailures): pause polling, call onStale if provided. */ export interface BackoffPollerOptions { /** Base polling interval i...
eren23/non_linear_ai_chat
frontend/src/lib/batchApi.ts
ts
5,462
b2ba48e9e3dff48478412ceb33ad19061456c5a9431788ecd38fabed49c202a0
/** * Batch API client for fetching multiple resources in a single request. * * Reduces N+1 queries by batching: * - Files: Fetch by ID, node, or group * - Messages: Fetch history for multiple nodes * - Metadata: Fetch flow metadata, tags, user facts */ import { API_BASE } from './api'; import { apiFetch } from...
eren23/non_linear_ai_chat
frontend/src/lib/csrfApi.ts
ts
4,330
89557b36785e6ab88babb180e8c8a2250c7e8abffdc74b5b03e56245e7d533db
/** * CSRF-Protected API Helper * * Provides a fetch wrapper that automatically includes CSRF tokens. * The token is read from the csrf_token cookie set by the backend. * * Usage: * ```typescript * import { apiFetch } from '@/lib/csrfApi'; * * // Instead of: * fetch('/api/endpoint', { method: 'POST', ... }) ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/parallelApi.test.ts
ts
11,267
2c2ad42854ca2f544a0cad1e4236c08ca7f153321f4fa020ca881b7249588752
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/notesApi.test.ts
ts
22,713
462939d11bf537cff380f0567da73edc6f259f913840eb2ff9b8162de414ad3d
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/notificationsApi.test.ts
ts
7,801
5a4f6e6769d0b6977f339615038d77164dad09d2488326a0b1861b082283554e
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/collabBroadcast.test.ts
ts
20,003
7c3988e5a0474e37178090c3497660a92f3f74171c6d5dd6a35a648b45003cb6
/** * Tests for collaboration broadcast utilities. * * Tests cover: * - broadcastNodeData() - Immediate node data broadcasting to collaborators * - broadcastNodeDataThrottled() - Throttled broadcasting for streaming updates * - broadcastPromptEdit() - Debounced prompt text broadcasting */ import { describe, it,...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/analyticsApi.test.ts
ts
12,350
476ae14d11fec30e997845276e29bb41db48bb0d2a31cb3d07d97978167c5487
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); import { getDailyStats, getModelUsageStats, getUserActivityPatterns, getCostTrends, getUserGrowthMetrics, getTopUsers, getUsageBreakdown, getUsageTrends, getUserUsageBreakdown...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/documentChatApi.test.ts
ts
17,872
c42fef905cfeb2c238eb2959028a3226d15380d64235d5aa5f60e78d8e966f3f
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); // Mock import.meta.env for API_BASE vi.stubGlobal('import', { meta: { env: {} } }); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => global...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/webOpsApi.test.ts
ts
9,007
51ad2613a8b5bcdf20744d9b9c2364b360103d61f0bb3413aa64e076d3077f15
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock the apiClient from api.ts vi.mock('../api', () => ({ apiClient: { get: vi.fn(), post: vi.fn(), }, })); import { checkWebOpsHealth, getWebOpsStats, webSearch, scrapeUrl, scrapeBatch, } from '../webOpsApi'; import { apiClient }...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/toolsApi.test.ts
ts
6,862
ceb4a1553de11013644b3fee90e600e6f9625fcd094f74350113069d7b13d7c9
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/sanitize.test.ts
ts
12,799
eb652f1e80a70699c3d421723a09bfec83aacf364e99d0db11db446861b53904
/** * Tests for input sanitization utilities. * * These functions are critical for security - they sanitize user input * before sending to the backend. Tests verify: * - Control character removal * - Length limiting * - Whitespace normalization * - Edge cases (null, undefined, empty strings) */ import { descr...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/documentsApi.test.ts
ts
16,404
3188e4c241259d3273e8a188e1ce770db8e209b966beb77a7618efd6f1d243b9
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); // Mock import.meta.env for API_BASE vi.stubGlobal('import', { meta: { env: {} } }); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => global...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/utils.test.ts
ts
5,819
268a9e87b328d0e0f5a6e1acb368eae267ed2dfade6c4f1188ac2478a51c7281
/** * Tests for general utility functions. * * Tests cover: * - cn() for class name merging * - generateId() for unique ID generation * - debounce() for debouncing function calls * - formatModelName() for LLM model name formatting */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; imp...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/fileUploadDedup.test.ts
ts
4,888
9e821e8fcf0f64b56f276130259533a85254bd58358a4d9b8483d44e308928f7
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'; import { getFileFingerprint, isDuplicateUpload, clearUploadFingerprint, clearNodeFingerprints, _resetForTesting, } from '../fileUploadDedup'; function makeFile(name: string, size: number, lastModified: number): File { const file = ne...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/capabilityMetadata.test.ts
ts
13,250
d3793251ec4fe7b7a2de5d61861a8794b8ec977bb65d5494eced36e71919ffa7
import { describe, it, expect } from 'vitest'; import { CAPABILITIES, CAPABILITY_ORDER, CAPABILITY_PRESETS, capabilitiesToBackend, backendToCapabilities, detectCapabilityPreset, getCapabilitiesByCategory, getCapabilityMeta, countActiveCapabilities, type CapabilityId, } from '../capabilityMetadata'; ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/apiTokensApi.test.ts
ts
7,797
cad373cf383ff63403d3912e0ba7755c171b613b8eb29192e533d5ebdd3ee705
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/toolMetadata.test.ts
ts
7,600
4aa9c6e5a6eccf6f7de3a77b65c4fb64220f5c5063638e32f0215dbec8cd8593
/** * Tests for tool metadata constants and utilities. * * Covers: * - TOOL_CATEGORIES β€” Category metadata (required fields, valid colors) * - TOOL_METADATA β€” Individual tool metadata (required fields, valid categories) * - ALL_TOOL_NAMES β€” Contains all tool names * - TOOL_PRESETS β€” Preset definitions with valid...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/models.test.ts
ts
7,177
f0b93ddd5d79d9870aea52a9768aec157096f228eeb3f7300c353e9c3398b6a9
/** * Tests for model configuration and utilities. * * Tests cover: * - DEFAULT_MODEL - Default model setting * - FALLBACK_MODELS - Minimal fallback list * - inferProviderFamily() - Infer family from model ID * - getModelInfo() - Get model by ID * - isValidModel() - Validate model ID * - getModelDisplayName() ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/notifications.test.ts
ts
6,527
88aa563c50c759a40cf860ce64d4aaed107503005dfdb64ecd6948c33d782c70
/** * Tests for notification utility functions. * * Covers: * - showNotification() β€” Shows toast + creates persistent notification * - showError() β€” Error notification shorthand * - showWarning() β€” Warning notification shorthand * - showSuccess() β€” Success notification shorthand * - showInfo() β€” Info notificati...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/csrfApi.401.test.ts
ts
3,156
e4e1d187f9adfc1e44ed2cd90688a76e35809f586ac2d9ba5cbe8f43d4e1831f
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); // Mock document.cookie let cookieStore = ''; Object.defineProperty(document, 'cookie', { get: () => cookieStore, set: (value: string) => { cookieStore = value; }, config...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/tasksApi.test.ts
ts
7,597
1e364e5098c354316b42067cd44b4711ddce745f6fe5d4062e1c22c59ebfcd23
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrf...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/formatters.test.ts
ts
3,616
2c23a617109b7edd46816daf87d73763a4b51cc1c3cf2042873122d6b1d0656d
/** * Tests for formatting utilities. * * Covers: * - formatDuration() β€” Milliseconds to human-readable duration * - formatRelativeTime() β€” ISO date string to relative time labels */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { formatDuration, formatRelativeTime } from '../f...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/apiCache.test.ts
ts
15,477
5eaf3d257ef667944840aa61aa2866cdcabed6ba659b447fa95b226d9dba71e9
/** * Tests for API cache layer. * * Tests cover: * - cachedFetch() - Cached fetch with TTL and stale-while-revalidate * - createCachedFetcher() - Create cached wrapper for fetcher functions * - createDedupedFetcher() - Request deduplication without caching * - prefetch() - Background data prefetching * - Cache...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/nodeContentExtractor.test.ts
ts
10,642
6f72de204d414f854dabf9a07e120adfdbec133c36f1e09d60a7d583dd75b65b
import { describe, it, expect } from 'vitest'; import { extractNodeContent, isImportableNodeType, getMessageRoleForType, } from '../nodeContentExtractor'; describe('isImportableNodeType', () => { it('returns true for chat nodes', () => { expect(isImportableNodeType('chat')).toBe(true); }); it('returns...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/sketchApi.test.ts
ts
7,560
2e741c425cc88a133c46bb1f3d50df5299e71153e888909390431cff534a1e3a
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrf...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/informationApi.test.ts
ts
6,717
2eb1c86ec79100bc905f26c7f7eada6cefd67e8f8397cbb984267b9c1446eb80
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/ocrApi.test.ts
ts
5,839
32515e03515b0d474325bccb02099625f3688860aa1a21d8aacedc1a24c4c6b9
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/telegramApi.test.ts
ts
4,166
e9f1a8107025a7c2d78605ab85768edb0af3d96a95cb4bc65b2339811fe20616
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/canvasZoom.test.ts
ts
11,738
8a6d02cd537bb809aeddd249703461b0d6efc3bea447359952f33a97308bdac6
/** * Tests for sidebar-aware canvas zoom and centering calculations. * * These utilities solve the problem where ReactFlow's fitView/setCenter * don't account for fixed-position sidebars overlaying the canvas. */ import { describe, it, expect } from 'vitest'; import { getVisibleBounds, getSidebarCenterOffset...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/globalSearchApi.test.ts
ts
4,683
e23cc9f2a0698e9cdd60c4b059d8b2886380307897144a6da7e61f5c73b75caa
import { describe, it, expect, vi, beforeEach } from 'vitest'; // --------------------------------------------------------------------------- // Mocks // --------------------------------------------------------------------------- vi.mock('@/lib/csrfApi', () => ({ apiFetch: vi.fn(), })); import { fetchGlobalSearch ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/batchApi.test.ts
ts
9,655
97df713ec3d01814cc9656a34ebb1e998ca182ddebf22561fe244ad72c760726
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/fuzzySearch.test.ts
ts
3,417
bdcbde2e767ccc9a3a62b9c59114c70cf4ae34e9bf486996d610926bb4f433d3
import { describe, it, expect } from 'vitest'; import { fuzzySearchItems, fuzzyMatchWord, sanitizeQuery } from '../fuzzySearch'; describe('sanitizeQuery', () => { it('trims whitespace', () => { expect(sanitizeQuery(' hello ')).toBe('hello'); }); it('limits to 200 characters', () => { const long = 'a'....
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/memoriesApi.test.ts
ts
24,698
a170c432b23855f0605dfc6a7ce51d8a6448e48ac7995b415a5322fb43760f72
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.crede...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/flowTabCleanup.test.ts
ts
2,044
b1261b79ca6334ccd23d53b2d9b1b6cc35029d71626a6ca5f39f46a0ac00ca42
import { describe, it, expect, vi } from 'vitest'; import { removeFlowsFromWorkspace } from '../flowTabCleanup'; function createStore(overrides?: Partial<Parameters<typeof removeFlowsFromWorkspace>[0]>) { return { tabs: [], currentFlowId: null, closeTabs: vi.fn(), clearFlow: vi.fn(), ...overrides...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/commitmentsApi.utilities.test.ts
ts
18,783
23ba9ba460edc91c8aaba3ee365d3cec8af97edc9ad5b49c138d9dbd96bb8a30
/** * Tests for commitmentsApi utility functions. * * Covers formatRelativeTime, isTaskOverdue, getSourceLabel, * formatRecurrenceDisplay, isRecurringTask, isRecurrenceOccurrence, * formatInTimezone, formatReminderTime, and getBrowserTimezone. */ import { describe, it, expect, vi, beforeEach, afterEach } from 'v...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/libraryApi.test.ts
ts
17,538
091637d30bf05a38c25af14901fcbb49e03ad2cff4b122432febb593ef084850
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/adminModelsApi.test.ts
ts
12,638
0cbab95a39b536469b009d2b73e1e75fa057716e1507510fe7200e30a8e1b08c
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/feedbackApi.test.ts
ts
9,218
8d2900b46092554963eb0e0029e2acb19538085a3b1a5b614850e9256869cd39
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/flowsApi.test.ts
ts
25,791
83e5c0b4b3b8f91eff43baab60ab2fb14ba02040cf7758cae59dc8ac6b959d9f
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); // Mock cache and event modules vi.mock('../apiCache', () => ({ cachedFetch: vi.fn((key, fn) => fn()), invalidateCache: vi.fn(), CA...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/adminApi.test.ts
ts
17,693
1b7b24343a6d9e1a243a2075ab0f965a01384b2c914be89e226453114b233900
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); const mockApiFetch = vi.hoisted(() => vi.fn()); vi.mock('../csrfApi', () => ({ apiFetch: mockApiFetch, })); import { getUsers, getWaitingList, get...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/audioApi.test.ts
ts
4,014
75d4f8bdd81c28a0a6a0845e2681e1a6330333950251e9d76e4cfd2577346fbf
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/toolActivityLabels.test.ts
ts
6,088
dd3eface5ebde3aaec8a59b3cb1114fb36ad438801748e2fe4a315775954bd1d
/** * Tests for tool activity label utilities. * * Covers: * - getToolActivityLabel() β€” Human-readable labels for live tool activity feedback * - getToolAttributionLabel() β€” Short labels for post-generation tool attribution * - Truncation behavior for long queries */ import { describe, it, expect } from 'vitest...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/cronApi.test.ts
ts
2,835
94dfa104ffadb156d895211b8048439a46a0f61d98e4575eb536e2099fda8ab2
import { beforeEach, describe, expect, it, vi } from 'vitest'; import { fetchCronHistory, fetchCronSummary } from '../cronApi'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); function mockResponse(data: unknown, ok = true, status = 200, headers?: Record<string, string>) { return { ok, status,...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/fileValidation.test.ts
ts
12,009
e96e54d967252434d806fbd1cd3766493acce8a156eb64f9a65b230ddd4bb749
/** * Tests for file validation utilities. * * These tests cover: * - File size formatting * - Constants validation * * Note: validateFileForUpload and validatePdfFile tests require the File API * which is only available in browser/jsdom environment. Those tests are * commented out due to jsdom ESM compatibili...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/snapping.test.ts
ts
14,272
2477107fd49880a07ace8b5c32933782aa7ba999dcab2968de0972ede0534ce0
/** * Tests for node snapping utilities. * * Tests cover: * - calculateNodeBounds() - Node bounding box calculation * - snapToGrid() - Grid snapping with magnetic pull * - getVisibleNearbyNodes() - Finding nearby nodes for alignment * - findNeighborAlignments() - Finding alignment opportunities * - calculateSna...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/socket.test.ts
ts
34,332
af9273454a5a13564b90c90131cfc3c74f5eea75d86b8d000b6d8e50532f5662
/** * Tests for Socket.io client module. * * Tests cover: * - initializeSocket() - Socket creation, configuration, event handler registration * - getSocket() - Singleton access * - connectSocket() - Connection management * - disconnectSocket() - Clean disconnect * - isSocketConnected() - Connection status check...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/userFactsApi.test.ts
ts
7,539
3d2b743649ab1abfd5e2f8539bbf22b6bb8b74d74b836dc081b49e446250245c
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/flowMetadataApi.test.ts
ts
8,028
daa88818323e6c1778c4e40334c6537589d8b7b6906074617ccdf8824001895e
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/domSanitize.test.ts
ts
15,768
949d58b311b86d2311f87d1650ea743ca428cb5ae3793a521a0a2739f9fcdc9f
/** * Tests for DOM sanitization utilities. * * Tests cover: * - sanitizeSVG() - SVG content sanitization (XSS prevention) * - sanitizeHTML() - HTML content sanitization * - sanitizeMarkdown() - Markdown content sanitization * - sanitizeURL() - URL sanitization * - detectDangerousPatterns() - Pattern detection ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/onboardingTemplates.test.ts
ts
9,362
94a11952bc1877b81252a8d6c0a89ed853e7d3758d1175431a8c751daf921c4e
/** * Tests for onboarding template generation. * * Tests cover: * - getOnboardingTemplate() - Template generation for different template IDs * - Template structure validation * - Node and edge relationships */ import { describe, it, expect } from 'vitest'; import { getOnboardingTemplate } from '../onboardingTe...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/spendingApi.test.ts
ts
10,098
7182f967939944b5542ae6eadfaed4f50ffe0a51296163324f4f000567aed5de
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); import { getSpendingStatus, getDailySpending, getSpendingByFlow, getSpendingHistory, getSpendingByOperation, getSpendingBySource, getSpendingTrends, type SpendingStatus, type ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/graphWorkerClient.test.ts
ts
36,433
578c2f4a99a89191f0f823c03ef5422892c228367f0518aa6b550e606f4b5ca6
/** * Tests for GraphWorkerClient. * * Tests cover: * - Worker initialization and lazy creation * - Message passing (postMessage / onmessage) * - Task queuing and completion * - Error handling (worker errors, timeouts, unknown errors) * - Serialization of nodes and edges * - Public API methods (getAncestryChai...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/urlUtils.test.ts
ts
2,217
2b2570941d17e1880fdf9d711166d71540c69dc82c2f8fb1d1b0a61b19eb08fb
import { describe, it, expect } from 'vitest'; import { getUrlPath } from '../urlUtils'; describe('urlUtils', () => { describe('getUrlPath', () => { it('extracts pathname from a full URL', () => { expect(getUrlPath('https://example.com/foo/bar')).toBe('/foo/bar'); }); it('strips query parameters'...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/flowEvents.test.ts
ts
6,293
efa8b853dad49a85c45d80a8f65d6b829f644e0a4351d292fa7c17d80ad1fcaa
/** * Tests for flow event system. * * Tests cover: * - FLOW_EVENTS constant - Event type definitions * - dispatchFlowEvent() - Custom event dispatching * - getAllFlowEvents() - Get all event names */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { FLOW_EVENTS, dispatchFlo...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/pretextService.test.ts
ts
19,315
69ed941d38a2ffaa7fcacc04a93ec5faa93575f042a47586ccf0fb1915f12c1b
/** * Tests for pretextService β€” DOM-free text measurement wrapper. * * Tests cover: * - measureTextHeight() β€” normal, empty, and zero-width cases * - prepareBatch() β€” batch preparation and cache population * - measureStreamingHeight() β€” streaming state tracking and re-prepare threshold * - finalizeStreaming() β€”...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/templatesApi.test.ts
ts
16,420
9b38a22678f8c7cdb1ba016580d6783839ca50996c09548268662c51279c9fab
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/caretPosition.test.ts
ts
5,653
4f92dd1bb74367ce01887a3d5c21f6779c4d626eb20d4aaa49725d19afcee853
// @vitest-environment happy-dom /** * Tests for caretPosition utility functions. * * getCaretCoordinates creates a mirror div to measure pixel coordinates * of a caret position within a textarea. getPanelOffset finds the closest * [class*="panel"] ancestor and returns its bounding rect offset. * * Key behaviors...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/graphApi.test.ts
ts
8,512
e16b9251a0c5260bbde98a891b69e337c1bac11de4f5a230d337e6d985f59c0b
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); import { getFlowGraphInsights, getUserTopics, getUserPeople, getFlowsByTopic, getGraphStats, } from '../graphApi'; function mo...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/graphLayout.test.ts
ts
10,320
ffb1264a4516f20cb51afa121fab9f7416163e2343c8df92f8c7cd73a2d38095
/** * Tests for graph layout algorithms. * * Tests cover: * - calculate2DLayout() - Force-directed 2D layout using D3 * - calculate3DLayout() - Force-directed 3D layout * - kMeansClustering() - K-means clustering for node grouping */ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { calc...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/tagsApi.test.ts
ts
7,785
9d3e280824f01ad76d9b135550a530d0fe263d1cc8ca9b86f8c3b8ac63c2c9cb
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/userStatsApi.test.ts
ts
6,926
5fca0ba67686a5266efaba6d0b843d04bc90fe46f6755c2bea8975a4c3aff45a
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); import { getUserStats, getFlowUsage, type UserStats, type FlowUsage, } from '../userStatsApi'; function mockResponse(data: any, ok = true, status = 200) { return { ok, status...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/csrfApi.test.ts
ts
10,643
ff0745485153d48385eb4bdf0b01de073e367ee1697c10ae6bd2afa018ae4c8f
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); // Polyfill document.cookie for node environment if (typeof document === 'undefined') { (globalThis as any).document = { cookie: '' }; } // Mock document.cookie let cookieStore = ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/authValidation.test.ts
ts
5,791
002c16575b177a330aa72ef8f2aeca769ce38691b8110268690d06975fa7d9c0
/** * Tests for client-side auth form validation utilities. * * Covers: * - validateEmail() β€” Email format validation * - validatePassword() β€” Password strength validation * - validateConfirmPassword() β€” Password match validation * - validateName() β€” Name length validation */ import { describe, it, expect } fr...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/bugReportsApi.test.ts
ts
6,651
c5c6177ee51bb8e5ab77942a63f208f6dc8ebe753313189336f2cca7ae66ae6f
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/knowledgeGraphApi.test.ts
ts
6,050
e5b7f79e57df65992b905d490db7473aca763ecc4e9ec2fee621a6bfb284a612
/** * Tests for knowledgeGraphApi β€” unified knowledge items and graph fetching. */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { fetchKnowledgeItems, getKnowledgeGraph, invalidateKnowledgeGraphCache, } from '../knowledgeGraphApi'; // Mock global fetch const mockFetch = vi....
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/filesApi.test.ts
ts
17,808
24ef8eaf1e94fb43fca42cea6c47bb46bcd91419155ba6abe0ae36ad2d14500b
// @vitest-environment happy-dom import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.crede...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/commitmentsApi.test.ts
ts
14,847
c8a1f7a4d8659a6bfea3d63b9772abfad286bfdbcef1f54f72568252bebea50a
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () => '', })); ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/tokenEstimation.test.ts
ts
17,689
b7e7e835279166fed83f2f1504f02ae5a9c91ce550e9e2c735d7130e1e4527e3
/** * Tests for token estimation utilities. * * Tests cover: * - estimateInfoNodeTokens() - Estimate tokens for information nodes * - estimateChainTokens() - Estimate tokens for ancestry chains * - formatTokenCount() - Format token counts for display * - getTokenUsagePercent() - Calculate percentage usage */ i...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/errorCategories.test.ts
ts
25,143
64d64afcfe7ac7bfb53440b8272810170d33f03d7e2e5b75390807628d878b31
/** * Tests for error categorization utilities. * * Tests cover: * - categorizeError() - Categorize errors by type * - getUserFriendlyMessage() - Get user-friendly error messages * - getToastMessage() - Get short toast messages * - isUserFriendlyMessage() - Check if message is already user-friendly * - ErrorCat...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/pollingUtils.test.ts
ts
11,639
352298a0aa34eaa373e0e6d796be79be8ed847cf6feac563120d082db87c8d38
/** * Tests for smart polling with exponential backoff. * * Covers: * - createBackoffPoller() β€” Factory for backoff poller instances * - start() β€” Immediate fire + scheduled polling * - stop() β€” Cancel polling and clean up * - reset() β€” Reset backoff state * - isStale() β€” Whether polling is paused due to failur...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/imageTemplatesApi.test.ts
ts
9,580
14755c5a1a1fe2a8ba3c5ab8dcca3ddba9e522ff2ebcbdb20509ac4304189315
import { describe, it, expect, vi, beforeEach } from 'vitest'; // Mock fetch globally before imports const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/timeFormat.test.ts
ts
12,475
8461ec3c5f8c329603cd822efb59c45658c87d80253e96ddde85e369e2005189
/** * Tests for time formatting utilities. * * Tests cover: * - formatRelativeTime() - Relative time formatting (just now, 5m ago, etc.) * - formatDuration() - Duration formatting (45s, 1h 30m, etc.) * - getTimestampLabel() - Accessibility labels for timestamps */ import { describe, it, expect } from 'vitest'; ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/pretextDimensions.test.ts
ts
20,171
7c5851219851bbcb27331324f90adfe802a0ef53d4d14c9c9dcd07975924abc1
/** * Tests for pretextDimensions β€” node height calculation combining * pretext text measurements with chrome heights and markdown corrections. * * Tests cover: * - estimateMarkdownOverhead() β€” headings, code fences, mermaid dedup, tables, * blockquotes, horizontal rules, list items, images, KaTeX display math ...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/calendarApi.test.ts
ts
15,499
285fe2b415347950f989a9656ce9520861d4398b958bb2f5a372e986235ab789
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); vi.mock('@/lib/csrfApi', () => ({ apiFetch: (input: any, init?: any) => globalThis.fetch(input, { ...init, credentials: init?.credentials ?? 'include' }), getCsrfToken: () =>...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/memoryGraphApi.test.ts
ts
9,292
3088f02a510088209a7c70937672e211f93d64368875f7702d79214008babbbd
import { describe, it, expect, vi, beforeEach } from 'vitest'; const mockFetch = vi.fn(); vi.stubGlobal('fetch', mockFetch); import { getMemoryGraph, getAvailableEntities, invalidateMemoryGraphCache, invalidateEntitiesCache, type MemoryGraph, type MemoryGraphOptions, type AvailableEntities, } from '../m...
eren23/non_linear_ai_chat
frontend/src/lib/__tests__/indexedDBCache.test.ts
ts
12,525
3657d771b57ff10eaccf7bcb2728263b9fa42e0110eebd76e5063d83b4cb4925
/** * Tests for IndexedDB-based persistent cache. * * Tests cover: * - getCachedImageFromDB() - Retrieve cached images * - setCachedImageInDB() - Store images in cache * - clearImageCacheDB() - Clear the cache * - getCacheStats() - Get cache statistics * - isIndexedDBAvailable() - Check for IndexedDB support *...