mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-29 06:32:28 +00:00
fix(test): address @claude review findings for parallel staleness PR
- Add missing checkStalenessAsync mock to calltool-dispatch.test.ts (BLOCKER: caused 5 CI failures on every list_repos test path) - Add async invalid-commit-hash test for symmetry with sync suite - Document why promisified execFile omits stdio option
This commit is contained in:
parent
4ad27d9200
commit
4c74029cf7
3 changed files with 9 additions and 0 deletions
|
|
@ -54,6 +54,8 @@ export async function checkStalenessAsync(
|
|||
lastCommit: string,
|
||||
): Promise<StalenessInfo> {
|
||||
try {
|
||||
// Note: promisified execFile captures stdout/stderr by default (no stdio option needed,
|
||||
// unlike the sync variant which requires explicit stdio: ['pipe','pipe','pipe']).
|
||||
const { stdout } = await execFileAsync('git', ['rev-list', '--count', `${lastCommit}..HEAD`], {
|
||||
cwd: repoPath,
|
||||
encoding: 'utf-8',
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ vi.mock('../../src/storage/repo-manager.js', () => ({
|
|||
// tests don't shell out to git.
|
||||
vi.mock('../../src/core/git-staleness.js', () => ({
|
||||
checkStaleness: vi.fn().mockReturnValue({ isStale: false, commitsBehind: 0 }),
|
||||
checkStalenessAsync: vi.fn().mockResolvedValue({ isStale: false, commitsBehind: 0 }),
|
||||
checkCwdMatch: vi.fn().mockResolvedValue({ match: 'none' }),
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,12 @@ describe('checkStalenessAsync', () => {
|
|||
expect(result.commitsBehind).toBe(0);
|
||||
});
|
||||
|
||||
it('fails open with invalid commit hash', async () => {
|
||||
const result = await checkStalenessAsync(process.cwd(), 'not-a-real-commit-hash');
|
||||
expect(result.isStale).toBe(false);
|
||||
expect(result.commitsBehind).toBe(0);
|
||||
});
|
||||
|
||||
it('parallel calls complete faster than sequential', async () => {
|
||||
let headCommit: string;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue