Home / File/ graph-cache.test.ts — mcp Source File

graph-cache.test.ts — mcp Source File

Architecture documentation for graph-cache.test.ts, a typescript file in the mcp codebase. 5 imports, 0 dependents.

File typescript GraphCache LruManagement 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  919aa576_8ce8_a725_8ee0_92bce17724fa["graph-cache.test.ts"]
  108c9ff4_bdb8_518a_9256_9ff4cd9d39a7["graph-cache.ts"]
  919aa576_8ce8_a725_8ee0_92bce17724fa --> 108c9ff4_bdb8_518a_9256_9ff4cd9d39a7
  04799611_7360_96bd_a002_0c06de0b1d90["GraphCache"]
  919aa576_8ce8_a725_8ee0_92bce17724fa --> 04799611_7360_96bd_a002_0c06de0b1d90
  f20c71b7_2411_d98b_88ba_3ebc36bdd1f5["buildIndexes"]
  919aa576_8ce8_a725_8ee0_92bce17724fa --> f20c71b7_2411_d98b_88ba_3ebc36bdd1f5
  59a82797_f6a2_36aa_02bd_7b2f22d1bc50["normalizePath"]
  919aa576_8ce8_a725_8ee0_92bce17724fa --> 59a82797_f6a2_36aa_02bd_7b2f22d1bc50
  9304f204_de38_9fc9_faf0_8f287591dc52["globals"]
  919aa576_8ce8_a725_8ee0_92bce17724fa --> 9304f204_de38_9fc9_faf0_8f287591dc52
  style 919aa576_8ce8_a725_8ee0_92bce17724fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, it, expect, beforeEach } from '@jest/globals';
import { GraphCache, buildIndexes, normalizePath } from './graph-cache';

describe('graph-cache', () => {
  describe('GraphCache', () => {
    let cache: GraphCache;

    beforeEach(() => {
      cache = new GraphCache({
        maxGraphs: 3,
        maxNodes: 100,
        maxAgeMs: 1000, // 1 second for testing
      });
    });

    describe('basic operations', () => {
      it('should store and retrieve a graph', () => {
        const graph = createMockIndexedGraph('key1', 10);

        cache.set('key1', graph);
        const retrieved = cache.get('key1');

        expect(retrieved).toBeDefined();
        expect(retrieved?.cacheKey).toBe('key1');
      });

      it('should return null for non-existent key', () => {
        const retrieved = cache.get('non-existent');
        expect(retrieved).toBeNull();
      });

      it('should check if key exists', () => {
        const graph = createMockIndexedGraph('key1', 10);

        cache.set('key1', graph);

        expect(cache.has('key1')).toBe(true);
        expect(cache.has('non-existent')).toBe(false);
      });

      it('should return cache status', () => {
        const graph1 = createMockIndexedGraph('key1', 10);
        const graph2 = createMockIndexedGraph('key2', 20);

        cache.set('key1', graph1);
        cache.set('key2', graph2);

        const status = cache.status();

        expect(status.graphs).toBe(2);
        expect(status.nodes).toBe(30);
        expect(status.keys).toContain('key1');
        expect(status.keys).toContain('key2');
      });
    });

    describe('LRU eviction', () => {
      it('should evict oldest entry when max graphs exceeded', () => {
        const graph1 = createMockIndexedGraph('key1', 10);
        const graph2 = createMockIndexedGraph('key2', 10);
// ... (379 more lines)

Domain

Subdomains

Frequently Asked Questions

What does graph-cache.test.ts do?
graph-cache.test.ts is a source file in the mcp codebase, written in typescript. It belongs to the GraphCache domain, LruManagement subdomain.
What functions are defined in graph-cache.test.ts?
graph-cache.test.ts defines 1 function(s): createMockIndexedGraph.
What does graph-cache.test.ts depend on?
graph-cache.test.ts imports 5 module(s): GraphCache, buildIndexes, globals, graph-cache.ts, normalizePath.
Where is graph-cache.test.ts in the architecture?
graph-cache.test.ts is located at src/cache/graph-cache.test.ts (domain: GraphCache, subdomain: LruManagement, directory: src/cache).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free