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

import dialogSource from './SkillCreateDialog.vue?raw';

describe('skill create and import contract', () => {
  it('offers manual authoring and independent standard ZIP batch import', () => {
    expect(dialogSource).toContain('value="manual">自己编写');
    expect(dialogSource).toContain('value="import">批量导入');
    expect(dialogSource).toContain('accept=".zip,application/zip"');
    expect(dialogSource).toContain('multiple');
    expect(dialogSource).toContain('const MAX_IMPORT_SKILLS = 50');
    expect(dialogSource).toContain('支持单技能或多技能 ZIP');
    expect(dialogSource).toContain('response.data.map((preview, index)');
    expect(dialogSource).toContain('importSkillConfirmBatch');
    expect(dialogSource).not.toContain('.efskill');
  });

  it('requires one shared category and visibility scope for the operation', () => {
    expect(dialogSource).toContain('v-model="form.categoryId"');
    expect(dialogSource).toContain('v-model="form.visibilityScope"');
    expect(dialogSource).toContain('visibilityScope: form.visibilityScope');
  });

  it('supports scanning arbitrary HTTPS Git repositories and selecting candidates', () => {
    expect(dialogSource).toContain('value="git">Git 仓库');
    expect(dialogSource).toContain('scanSkillGitRepository');
    expect(dialogSource).toContain('prepareSkillGitCandidates');
    expect(dialogSource).toContain('搜索技能名称、用途或路径');
    expect(dialogSource).toContain('toggleGitCandidate(candidate)');
    expect(dialogSource).toContain('next.size >= MAX_IMPORT_SKILLS');
    expect(dialogSource).not.toContain('github.com/');
  });
});
