From b1fc33583face6eb1b0285ba9838bdec1d9c5fdf Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 13 Jun 2026 11:46:40 +0100 Subject: [PATCH] test: fix tests --- server/utils/sync-ref.ts | 2 +- test/unit/sync-ref.spec.ts | 5 ++++- test/utils/git-wire.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/utils/sync-ref.ts b/server/utils/sync-ref.ts index ce9265a..c2b371d 100644 --- a/server/utils/sync-ref.ts +++ b/server/utils/sync-ref.ts @@ -2,9 +2,9 @@ import { and, eq, sql } from 'drizzle-orm' import { repoMapping } from '../db/schema' import { useDb } from './db' import { RemoteRejectedError, WireError } from './git-wire/errors' +import { fetchAdvertisement } from './git-wire/upload-pack' import { installationOctokit } from './github-app' import { spliceDelete, splicePush } from './splice' -import { fetchAdvertisement } from './git-wire/upload-pack' export type RefType = 'branch' | 'tag' diff --git a/test/unit/sync-ref.spec.ts b/test/unit/sync-ref.spec.ts index ecb8214..c4d8afc 100644 --- a/test/unit/sync-ref.spec.ts +++ b/test/unit/sync-ref.spec.ts @@ -14,8 +14,11 @@ const splicePushMock = vi.fn<(params: Record) => Promise<{ stat const spliceDeleteMock = vi.fn<(params: Record) => Promise<{ status: string }>>() const octokitAuthMock = vi.fn<(input: { type: 'installation' }) => Promise<{ token: string }>>() -vi.mock('../../server/utils/splice', () => ({ +vi.mock('../../server/utils/git-wire/upload-pack', () => ({ fetchAdvertisement: (repo: string, token: string) => fetchAdvertisementMock(repo, token), +})) + +vi.mock('../../server/utils/splice', () => ({ splicePush: (params: Record) => splicePushMock(params), spliceDelete: (params: Record) => spliceDeleteMock(params), })) diff --git a/test/utils/git-wire.ts b/test/utils/git-wire.ts index eeb38d5..7fda3de 100644 --- a/test/utils/git-wire.ts +++ b/test/utils/git-wire.ts @@ -28,6 +28,7 @@ export class GitFixture { initBare(name: string): string { const repo = path.join(this.dir, name) this.git(['init', '-q', '--bare', repo]) + this.git(['symbolic-ref', 'HEAD', 'refs/heads/__synchub_placeholder'], repo) return repo } -- 2.51.2