feat: add verification evidence presets

This commit is contained in:
ejclaw
2026-05-26 02:04:04 +09:00
parent 48ee682b3e
commit c4c590ec9b
14 changed files with 1435 additions and 75 deletions

View File

@@ -0,0 +1,46 @@
import { describe, expect, it } from 'vitest';
import {
buildGitHubEvidenceCommand,
normalizeGitHubRepo,
normalizePositiveInteger,
} from './github-evidence.js';
describe('GitHub evidence helpers', () => {
it('validates repo and numeric identifiers', () => {
expect(normalizeGitHubRepo('owner/repo')).toBe('owner/repo');
expect(() => normalizeGitHubRepo('../repo')).toThrow(
'Unsupported GitHub repo',
);
expect(normalizePositiveInteger(12, 'pr_number')).toBe(12);
expect(() => normalizePositiveInteger(0, 'pr_number')).toThrow(
'Missing or invalid pr_number',
);
});
it('builds fixed gh commands', () => {
expect(
buildGitHubEvidenceCommand({
action: 'github_pr_status',
repo: 'owner/repo',
prNumber: 164,
}).args,
).toEqual([
'pr',
'view',
'164',
'--repo',
'owner/repo',
'--json',
'number,title,state,mergeStateStatus,headRefName,baseRefName,headRefOid,url,statusCheckRollup',
]);
expect(
buildGitHubEvidenceCommand({
action: 'github_run_status',
repo: 'owner/repo',
runId: 123,
}).args,
).toContain('123');
});
});