feat: add git reference support for scenario previews; implement git ref handling in admin router and frontend

This commit is contained in:
2026-01-17 14:27:11 +00:00
parent 07ea17dacf
commit 70c7c0b039
7 changed files with 367 additions and 37 deletions
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest';
import { listScenarioPreviews, resolveGitCommitSha } from '../src/scenario/scenarioCatalog.js';
describe('scenarioCatalog git ref support', () => {
it('resolves HEAD to a commit hash', async () => {
const commitSha = await resolveGitCommitSha('HEAD');
expect(commitSha).toMatch(/^[0-9a-f]{40}$/i);
});
it('loads scenario previews from a git ref', async () => {
const previews = await listScenarioPreviews({ gitRef: 'HEAD' });
expect(previews.length).toBeGreaterThan(0);
const ids = previews.map((scenario) => scenario.id);
const sorted = [...ids].sort((a, b) => a - b);
expect(ids).toEqual(sorted);
});
});