Remove duplicated and constant-only tests

This commit is contained in:
Chris Scott committed 2026-11-13 15:30:56 -05:00
1 parent ee4ef8217d
commit 71bde0378a
8 files changed
+17 -366

No files matched your search

-33
View File
@@ -1136,39 +1136,6 @@ describe('repo service real git', () => {
expect(describeAfterRun(path.join(root, 'job-999999-run-1'))).toBeUndefined()
})
it('returns repo siblings when the OpenCode client fails', async () => {
const { getSiblingRepos } = await import('../../src/services/repo')
const origin = path.join(workspaceRoot, uniqueName('sibling-err-origin.git'))
const work = path.join(workspaceRoot, uniqueName('sibling-err-work'))
createOrigin(origin, work)
const repoA = path.join(reposPath, uniqueName('sibling-err-a'))
cloneOrigin(origin, repoA)
const a = createRepo(db, {
isLocal: true,
localPath: path.basename(repoA),
sourcePath: repoA,
branch: 'main',
defaultBranch: 'main',
cloneStatus: 'ready',
clonedAt: Date.now(),
})
const client = createStubOpenCodeClient({
api: {
location: {
get: async () => {
throw new Error('upstream unavailable')
},
},
worktree: { list: async () => [] },
},
})
const siblings = await getSiblingRepos(db, a.id, {}, client)
expect(siblings.some((repo) => repo.id === a.id)).toBe(true)
expect(siblings.some((repo) => isWorktreeSibling(repo))).toBe(false)
})
it('resolves the project id with the shared resolver', async () => {
const origin = path.join(workspaceRoot, uniqueName('sibling-resolver-origin.git'))
const work = path.join(workspaceRoot, uniqueName('sibling-resolver-work'))
-35
View File
@@ -8,13 +8,11 @@ import { getReposPath } from '@opencode-manager/shared/config/env'
import type { OpenCodeClient } from '../../src/services/opencode/client'
import type { Repo } from '../../src/types/repo'
import { createScheduleRun, updateScheduleRunWorktree } from '../../src/db/schedules'
import { getRepoByLocalPath } from '../../src/db/queries'
import {
discoverLocalRepos,
getSiblingRepos,
initLocalRepo,
listRepoSiblings,
relinkReposFromSessionDirectories,
resolveRepoForDirectory,
} from '../../src/services/repo'
import { cloneOrigin, createCommittedRepo, createGitAuthService, createOrigin, git } from '../helpers/git-fixtures'
@@ -43,15 +41,6 @@ describe('repo service', () => {
workspace.restore()
})
it('creates a new empty git repo for a relative path', async () => {
const result = await initLocalRepo(db, gitAuthService, 'my-new-repo')
expect(result.cloneStatus).toBe('ready')
expect(result.fullPath).toBe(path.join(getReposPath(), 'my-new-repo'))
expect(git(['rev-parse', '--git-dir'], result.fullPath)).toBe('.git')
expect(getRepoByLocalPath(db, 'my-new-repo')?.cloneStatus).toBe('ready')
})
it('links an absolute git repo in place and preserves its source path', async () => {
const sourcePath = path.join(workspace.path, 'outside', 'existing-repo')
createCommittedRepo(sourcePath)
@@ -102,30 +91,6 @@ describe('repo service', () => {
chmodSync(restricted, 0o755)
}
})
it('relinks imported session directories to nearest git repo roots', async () => {
const repoRoot = path.join(workspace.path, 'projects', 'app-one')
const webDirectory = path.join(repoRoot, 'apps', 'web')
const apiDirectory = path.join(repoRoot, 'packages', 'api')
const nonRepoDirectory = path.join(workspace.path, 'projects', 'not-a-repo')
createCommittedRepo(repoRoot)
mkdirSync(webDirectory, { recursive: true })
mkdirSync(apiDirectory, { recursive: true })
mkdirSync(nonRepoDirectory, { recursive: true })
const result = await relinkReposFromSessionDirectories(db, gitAuthService, [
webDirectory,
apiDirectory,
nonRepoDirectory,
])
expect(result.relinkedCount).toBe(1)
expect(result.existingCount).toBe(0)
expect(result.nonRepoPathCount).toBe(1)
expect(result.duplicatePathCount).toBe(1)
expect(result.errors).toEqual([])
expect(result.repos.map((repo) => repo.fullPath)).toEqual([repoRoot])
})
})
describe('getSiblingRepos worktree API', () => {