The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(memory): add test files for memory components
Steven Enamakel3a147392568f
diff --git a/app/src/components/intelligence/__tests__/MemoryOverview.test.tsx b/app/src/components/intelligence/__tests__/MemoryOverview.test.tsxindex 81464806e1..7f1de2f696 100644--- a/app/src/components/intelligence/__tests__/MemoryOverview.test.tsx+++ b/app/src/components/intelligence/__tests__/MemoryOverview.test.tsx@@ -1,7 +1,6 @@import { fireEvent, render, screen } from '@testing-library/react';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import type { Chunk, EntityRef, GraphRelation, Source } from '../../../utils/tauriCommands';import { MemoryHeatmap } from '../MemoryHeatmap';function localDayAt(daysAgo: number, hour: number, minute = 0): number {@@ -12,54 +11,6 @@ function localDayAt(daysAgo: number, hour: number, minute = 0): number {return d.getTime();}-function makeChunk(overrides: Partial<Chunk> = {}): Chunk {- return {- id: 'chunk-1',- source_kind: 'email',- source_id: 'gmail:[email protected]',- owner: '[email protected]',- timestamp_ms: localDayAt(0, 10),- token_count: 100,- lifecycle_status: 'admitted',- content_preview: 'Memory item',- has_embedding: true,- tags: [],- ...overrides,- };-}--function makeSource(overrides: Partial<Source> = {}): Source {- return {- source_id: 'gmail:[email protected]',- display_name: 'Alice Inbox',- source_kind: 'email',- chunk_count: 3,- most_recent_ms: localDayAt(0, 10),- lifecycle_status: 'admitted',- ...overrides,- };-}--function makeEntity(overrides: Partial<EntityRef> = {}): EntityRef {- return { entity_id: 'person:Alice', kind: 'person', surface: 'Alice', count: 3, ...overrides };-}--function makeRelation(overrides: Partial<GraphRelation> = {}): GraphRelation {- return {- namespace: 'gmail',- subject: 'Alice',- predicate: 'prefers',- object: 'morning updates',- attrs: { entity_types: { subject: 'person', object: 'preference' } },- updatedAt: localDayAt(0, 10),- evidenceCount: 2,- orderIndex: null,- documentIds: ['doc-1'],- chunkIds: ['chunk-1'],- ...overrides,- };-}-function paragraphMatching(pattern: RegExp) {return (_content: string, node: Element | null) =>node?.tagName.toLowerCase() === 'p' &&diff --git a/app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx b/app/src/components/intelligence/__tests__/MemoryPresentation.test.tsxindex 8d43b738fd..1974e255cc 100644--- a/app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx+++ b/app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx@@ -1,36 +1,11 @@-import { act, fireEvent, render, screen, within } from '@testing-library/react';+import { act, fireEvent, render, screen } from '@testing-library/react';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { ActionableItem } from '../../../types/intelligence';-import type { Chunk } from '../../../utils/tauriCommands';import { ActionableCard } from '../ActionableCard';import { MemoryEmptyPlaceholder } from '../MemoryEmptyPlaceholder';import { MemoryStatsBar } from '../MemoryStatsBar';-function makeChunk(overrides: Partial<Chunk> = {}): Chunk {- return {- id: 'chunk-1',- source_kind: 'email',- source_id: 'gmail:[email protected]|[email protected]',- owner: '[email protected]',- timestamp_ms: Date.now(),- token_count: 120,- lifecycle_status: 'admitted',- content_preview: 'Review launch checklist. Include final QA notes.',- has_embedding: true,- tags: [],- ...overrides,- };-}--function localDayAt(daysAgo: number, hour: number, minute = 0): number {- const d = new Date(Date.now());- d.setHours(0, 0, 0, 0);- d.setDate(d.getDate() - daysAgo);- d.setHours(hour, minute, 0, 0);- return d.getTime();-}-function makeActionableItem(overrides: Partial<ActionableItem> = {}): ActionableItem {const createdAt = new Date(Date.now() - 2 * 60 * 1000);return {diff --git a/app/src/components/intelligence/__tests__/MemoryTextAndDetail.test.tsx b/app/src/components/intelligence/__tests__/MemoryTextAndDetail.test.tsxindex a42db88ba3..0887009f7a 100644--- a/app/src/components/intelligence/__tests__/MemoryTextAndDetail.test.tsx+++ b/app/src/components/intelligence/__tests__/MemoryTextAndDetail.test.tsx@@ -1,12 +1,7 @@-import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';-import { beforeEach, describe, expect, it, vi } from 'vitest';+import { render, screen } from '@testing-library/react';+import { describe, expect, it, vi } from 'vitest';-import type {- Chunk,- EntityRef,- MemoryRetrievalEntity,- ScoreBreakdown,-} from '../../../utils/tauriCommands';+import type { MemoryRetrievalEntity } from '../../../utils/tauriCommands';import { MemoryTextWithEntities } from '../MemoryTextWithEntities';const rpcMocks = vi.hoisted(() => ({@@ -25,37 +20,6 @@ vi.mock('../../../utils/tauriCommands', async () => {};});-const BASE_CHUNK: Chunk = {- id: 'chunk-1234567890abcdef',- source_kind: 'email',- source_id: 'gmail:[email protected]|[email protected]',- source_ref: 'gmail://msg/abc',- owner: '[email protected]',- timestamp_ms: Date.UTC(2026, 4, 16, 9, 30, 0),- token_count: 220,- lifecycle_status: 'admitted',- content_preview:- 'Project Atlas kickoff. Alice (PERSON) owns Atlas (PROJECT). Follow up tomorrow.',- has_embedding: true,- tags: ['person/Alice'],-};--const ENTITIES: EntityRef[] = [- { entity_id: 'person:Alice', kind: 'person', surface: 'Alice', count: 2 },- { entity_id: 'project:Atlas', kind: 'project', surface: 'Atlas', count: 1 },-];--const SCORE: ScoreBreakdown = {- signals: [- { name: 'recency', weight: 0.4, value: 0.8 },- { name: 'importance', weight: 0.6, value: 0.6 },- ],- total: 0.68,- threshold: 0.5,- kept: true,- llm_consulted: false,-};-describe('MemoryTextWithEntities', () => {it('renders nothing when there is no text or entity chip data', () => {const { container } = render(<MemoryTextWithEntities text="" />);