Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

1.4 KB
Raw Blame
import { describe, expect, it, vi } from 'vitest';

/**
 * Which integrations this deployment has credentials for: what GET
 * /api/integrations/config answers a member and the internal endpoint the
 * MCP layer reads (Product Visibility asks for Merchant Center only where
 * it is offered). Booleans only.
 */

const configured = vi.hoisted(() => new Set());
vi.mock('../config/supabase.js', () => ({ default: {} }));
vi.mock('../lib/composio.js', () => ({
  isComposioConfigured: (provider) => configured.has(provider),
}));
vi.mock('../lib/ga-sync.js', () => ({ runGaSync: vi.fn() }));
vi.mock('../lib/gsc-sync.js', () => ({ runGscSync: vi.fn() }));
vi.mock('../lib/page-opportunities.js', () => ({ detectPageOpportunitiesInWindow: vi.fn() }));
vi.mock('../lib/access.js', () => ({ assertBrandAccess: vi.fn() }));

const { integrationsConfig } = await import('./integrations.js');

describe('integrationsConfig', () => {
  it('says Merchant Center is offered only with its auth config', () => {
    expect(integrationsConfig()).toMatchObject({
      googleSearchConsole: false,
      googleAnalytics: false,
      googleMerchantCenter: false,
    });
    configured.add('google-merchant-center');
    configured.add('google-search-console');
    expect(integrationsConfig()).toMatchObject({
      googleSearchConsole: true,
      googleAnalytics: false,
      googleMerchantCenter: true,
    });
  });
});