import { describe, expect } from 'vitest';
import { evalTest } from './test-helper.js';

describe('core_feature', () => {
  // New tests MUST start as USUALLY_PASSES
  evalTest('USUALLY_PASSES', {
    name: 'should perform expected agent action',
    setup: async (rig) => {
      // For mocking offline MCP:
      // rig.addMockMcpServer('workspace-server', 'google-workspace');
    },
    files: {
      'src/app.ts': '// some code',
    },
    prompt: 'Task description here',
    timeout: 60000, // 1 minute safety limit
    assert: async (rig, result) => {
      // 1. Audit the trajectory (Safe for standard evalTest)
      const logs = rig.readToolLogs();
      const hasTool = logs.some((l) => l.toolRequest.name === 'read_file');
      expect(hasTool, 'Agent should have read the file').toBe(true);

      // 2. Assert efficiency (Cost/Turn)
      expect(logs.length).toBeLessThan(5);

      // 3. Assert final output
      expect(result).toContain('Expected Keyword');
    },
  });
});
