phase-five-editor-page-runtime-dependencies.test.ts 1.92 KB
import { describe, expect, it } from 'vitest';

import agentTagEditorPageSource from '../routes/agent-tags/AgentTagEditorPage.tsx?raw';
import agentEditorPageSource from '../routes/agents/AgentEditorPage.tsx?raw';
import channelCodeEditorPageSource from '../routes/channel-codes/ChannelCodeEditorPage.tsx?raw';
import officialSiteMethodologyPageSource from '../routes/official-site/OfficialSiteMethodologyPage.tsx?raw';
import agentDisplayConfigEditModalSource from '../routes/official-site-agent-display-config/AgentDisplayConfigEditModal.tsx?raw';
import officialSiteAgentDisplayConfigPageSource from '../routes/official-site-agent-display-config/OfficialSiteAgentDisplayConfigPage.tsx?raw';
import officialSiteJobTabEditorPageSource from '../routes/official-site-job-tabs/OfficialSiteJobTabEditorPage.tsx?raw';

const editorPageRuntimeFiles = [
  ['AgentEditorPage.tsx', agentEditorPageSource],
  ['AgentTagEditorPage.tsx', agentTagEditorPageSource],
  ['ChannelCodeEditorPage.tsx', channelCodeEditorPageSource],
  ['OfficialSiteMethodologyPage.tsx', officialSiteMethodologyPageSource],
  ['AgentDisplayConfigEditModal.tsx', agentDisplayConfigEditModalSource],
  ['OfficialSiteAgentDisplayConfigPage.tsx', officialSiteAgentDisplayConfigPageSource],
  ['OfficialSiteJobTabEditorPage.tsx', officialSiteJobTabEditorPageSource],
];

describe('phase five editor page local ui runtime dependencies', () => {
  it.each(editorPageRuntimeFiles)('%s no longer imports packages/ui', (_, source) => {
    expect(source).not.toContain('packages/ui');
  });

  it.each([
    ['AgentTagEditorPage.tsx', agentTagEditorPageSource],
    ['ChannelCodeEditorPage.tsx', channelCodeEditorPageSource],
    ['OfficialSiteJobTabEditorPage.tsx', officialSiteJobTabEditorPageSource],
  ])('%s uses BusinessForm instead of direct TDesign form controls', (_, source) => {
    expect(source).toContain('BusinessForm');
    expect(source).not.toContain('TDesignAccessibleControls');
  });
});