// {{ display_name }} MCP server — generated by mcpify. Do not hand-edit.
//
// Runs against the real mcp_store.db, populated by `npm run
// populate-embeddings` before tests run (see run_generated_tests) — this is
// what actually proves indexing-time and live-query embeddings agree.

import { afterAll, describe, expect, it } from 'vitest';

import { DEFAULT_API_VERSION } from '../../../src/core/config-schema.js';
import { closeStore, openStore } from '../../../src/data/store-repository.js';
import { searchOperations } from '../../../src/tools/search-tool.js';

const store = openStore(DEFAULT_API_VERSION);
afterAll(() => closeStore(store));

describe('searchOperations', () => {
  it('returns an array of results without throwing', async () => {
    const results = await searchOperations(store, 'find an operation', 5);
    expect(Array.isArray(results)).toBe(true);
  });

  it('respects the limit parameter', async () => {
    const results = await searchOperations(store, 'find an operation', 1);
    expect(results.length).toBeLessThanOrEqual(1);
  });
});
