Use the fixture builders when tests need parsed repository, branch, ref,
commit, issue, or pull request fixtures without constructing a complete initial
state. See docs/api-reference.md for the detailed
fixture schema fields.
import {
buildRepositoryFixture,
buildBranchFixture,
buildRefFixture,
buildCommitFixture,
buildIssueFixture,
buildPullRequestFixture
} from 'simulacat-core';
const repo = buildRepositoryFixture({owner: 'acme', name: 'awesome-repo'});
const branch = buildBranchFixture({
owner: 'acme',
repo: 'awesome-repo',
name: 'main'
});
const commit = buildCommitFixture({
owner: 'acme',
repo: 'awesome-repo',
sha: 'abc123'
});
const ref = buildRefFixture({
owner: 'acme',
repo: 'awesome-repo',
qualifiedName: 'main',
object: {sha: commit.sha}
});
const issue = buildIssueFixture({
owner: 'acme',
repo: 'awesome-repo',
number: 1,
title: 'Document first-class entities'
});
const pullRequest = buildPullRequestFixture({
owner: 'acme',
repo: 'awesome-repo',
number: 2,
title: 'Add entity spine',
base: {ref: 'main', sha: commit.sha},
head: {ref: 'feature/entity-spine', sha: 'def456'}
});
These functions validate their input against the relevant Zod schema and throw on invalid data.