phase-three-runtime-dependencies.test.ts 1.18 KB
import { describe, expect, it } from 'vitest';

import useMessageSource from '../hooks/useMessage.tsx?raw';
import adminShellSource from '../layouts/AdminShell.tsx?raw';
import agentDetailDrawerSource from '../routes/agents/AgentDetailDrawer.tsx?raw';
import channelCodeViewDrawerSource from '../routes/channel-codes/ChannelCodeViewDrawer.tsx?raw';
import skillDetailDrawerSource from '../routes/skills/SkillDetailDrawer.tsx?raw';

const phaseThreeRuntimeFiles = [
  ['useMessage.tsx', useMessageSource],
  ['AdminShell.tsx', adminShellSource],
  ['AgentDetailDrawer.tsx', agentDetailDrawerSource],
  ['ChannelCodeViewDrawer.tsx', channelCodeViewDrawerSource],
  ['SkillDetailDrawer.tsx', skillDetailDrawerSource],
];

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

  it('useMessage imports the React 19 adapter from the TDesign ESM entry', () => {
    expect(useMessageSource).toContain("import 'tdesign-react/es/_util/react-19-adapter.js';");
    expect(useMessageSource).not.toContain("tdesign-react/lib/_util/react-19-adapter.js");
  });
});