import { describe, expect, test } from 'vitest';

import { runtimesForProfile } from '../../convex/runtimeSupport';

describe('runtimesForProfile', () => {
  test('anthropic + api_key drives claude and opencode', () => {
    expect(
      runtimesForProfile({ provider: 'anthropic', authType: 'api_key' }),
    ).toEqual(['claude', 'opencode']);
  });

  test('opencode_openai_login snapshot drives codex only', () => {
    expect(
      runtimesForProfile({
        provider: 'opencode_openai_login',
        authType: 'opencode_auth_json',
      }),
    ).toEqual(['codex']);
  });

  test('anthropic + anthropic_oauth_json drives claude only', () => {
    expect(
      runtimesForProfile({
        provider: 'anthropic',
        authType: 'anthropic_oauth_json',
      }),
    ).toEqual(['claude']);
  });

  test('openrouter + api_key drives opencode only', () => {
    expect(
      runtimesForProfile({ provider: 'openrouter', authType: 'api_key' }),
    ).toEqual(['opencode']);
  });

  test('openai + api_key drives opencode and codex', () => {
    expect(
      runtimesForProfile({ provider: 'openai', authType: 'api_key' }),
    ).toEqual(['opencode', 'codex']);
  });
});
