test: remove 52 low-value plugin, checks, and runtime tests (#38909)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-06 00:17:38 -08:00
committed by GitHub
co-authored by OrcaWin
parent 9cbef961cc
commit 687b0ee252
17 changed files with 0 additions and 2109 deletions
@@ -1,96 +0,0 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type * as GitHubApiRepositoryModule from '../../github-api-repository'
const { ghExecFileAsyncMock } = vi.hoisted(() => ({ ghExecFileAsyncMock: vi.fn() }))
vi.mock('../../gh-utils', () => ({
ghExecFileAsync: ghExecFileAsyncMock,
acquire: vi.fn(async () => undefined),
release: vi.fn()
}))
vi.mock('../../github-repository-identity', () => ({
withGitHubRepoExecution: (_r: string, _c: unknown, _l: unknown, run: () => unknown) => run(),
githubRepoContext: (repoPath: string) => ({ repoPath }),
ghRepoExecOptions: (context: { repoPath: string }) => ({ cwd: context.repoPath })
}))
vi.mock('../../github-read-execution-scope', () => ({ githubReadExecutionScope: () => 'local' }))
vi.mock('../../github-api-repository', async (importOriginal) => ({
...(await importOriginal<typeof GitHubApiRepositoryModule>()),
resolveGitHubRepoExecution: async () => ({
ownerRepo: { owner: 'acme', repo: 'widgets' },
ghOptions: { cwd: '/repo' }
})
}))
vi.mock('../../rate-limit', () => ({ noteRepositoryRateLimitSpend: vi.fn() }))
vi.mock('../lookup/pr-lookup-rate-limit', () => ({ assertRateLimitBudget: vi.fn() }))
import { getPRChecks } from './get-pr-checks'
const HEAD = 'a'.repeat(40)
beforeEach(() => {
ghExecFileAsyncMock.mockReset()
})
describe('getPRChecks run times', () => {
it('reads the rollup without gh’s disk cache, which ignores the PR head', async () => {
ghExecFileAsyncMock.mockResolvedValueOnce({
stdout: JSON.stringify({
data: {
repository: {
pullRequest: {
headRefOid: HEAD,
commits: { nodes: [{ commit: { oid: HEAD, statusCheckRollup: null } }] }
}
}
}
})
})
await getPRChecks('/repo', 1, HEAD)
expect(ghExecFileAsyncMock.mock.calls[0]?.[0]).not.toContain('--cache')
})
it('keeps REST check-run times through the fallback’s schema', async () => {
ghExecFileAsyncMock
.mockRejectedValueOnce(new Error('GraphQL rollup failed'))
.mockResolvedValueOnce({
stdout: JSON.stringify({
total_count: 1,
check_runs: [
{
id: 88,
name: 'build',
status: 'completed',
conclusion: 'failure',
html_url: 'https://github.com/acme/widgets/runs/88',
details_url: null,
started_at: '2026-11-05T10:00:00Z',
completed_at: '2026-11-05T10:03:12Z'
}
]
})
})
.mockResolvedValueOnce({ stdout: JSON.stringify({ total_count: 0, statuses: [] }) })
.mockResolvedValueOnce({ stdout: JSON.stringify({ total_count: 0, check_suites: [] }) })
const [check] = await getPRChecks('/repo', 2, HEAD)
expect(check).toMatchObject({
startedAt: '2026-11-05T10:00:00Z',
completedAt: '2026-11-05T10:03:12Z'
})
})
it('asks an older gh without run-time fields for the fields it knows', async () => {
ghExecFileAsyncMock
.mockRejectedValueOnce(new Error('GraphQL rollup failed'))
.mockRejectedValueOnce(new Error('REST details failed'))
.mockRejectedValueOnce(
Object.assign(new Error('Command failed'), { stderr: 'Unknown JSON field: "startedAt"' })
)
.mockResolvedValueOnce({
stdout: JSON.stringify([{ name: 'lint', state: 'PASS', link: '' }])
})
const checks = await getPRChecks('/repo', 3, HEAD)
expect(ghExecFileAsyncMock.mock.calls[3]?.[0]).toContain('name,state,link')
expect(checks.map((check) => check.name)).toEqual(['lint'])
})
})
@@ -1,99 +0,0 @@
import { describe, expect, it } from 'vitest'
import {
mapGraphQLPRChecksResponse,
mapRestCheckRun,
mapRestCommitStatus
} from './pr-checks-response-mapping'
import type { GraphQLPRChecksResponse, GraphQLStatusCheckContext } from './pr-checks-graphql-query'
const repo = { owner: 'acme', repo: 'widgets' }
function rollup(contexts: GraphQLStatusCheckContext[]): GraphQLPRChecksResponse {
return {
data: {
repository: {
pullRequest: {
headRefOid: 'a'.repeat(40),
commits: {
nodes: [
{
commit: {
oid: 'a'.repeat(40),
statusCheckRollup: { contexts: { nodes: contexts } }
}
}
]
}
}
}
}
}
}
describe('check run times', () => {
it('carries when each GraphQL check ran, dropping GitHub’s unset zero time', () => {
const checks = mapGraphQLPRChecksResponse(
repo,
rollup([
{
__typename: 'CheckRun',
name: 'build',
status: 'COMPLETED',
conclusion: 'FAILURE',
startedAt: '2026-11-05T10:00:00Z',
completedAt: '2026-11-05T10:03:12Z'
},
{
__typename: 'CheckRun',
name: 'lint',
status: 'QUEUED',
conclusion: null,
startedAt: '0001-01-01T00:00:00Z',
completedAt: null
},
{
__typename: 'StatusContext',
context: 'jenkins',
state: 'FAILURE',
createdAt: '2026-11-05T09:00:00Z'
},
{
__typename: 'StatusContext',
context: 'deploy',
state: 'PENDING',
createdAt: '2026-11-05T09:30:00Z'
}
])
)
expect(
checks?.map(({ name, startedAt, completedAt }) => ({ name, startedAt, completedAt }))
).toEqual([
{ name: 'build', startedAt: '2026-11-05T10:00:00Z', completedAt: '2026-11-05T10:03:12Z' },
{ name: 'lint', startedAt: undefined, completedAt: undefined },
// A commit status's one time is when its result was posted; a pending one has no run yet.
{ name: 'jenkins', startedAt: undefined, completedAt: '2026-11-05T09:00:00Z' },
{ name: 'deploy', startedAt: undefined, completedAt: undefined }
])
})
it('carries REST check-run and commit-status times', () => {
expect(
mapRestCheckRun({
name: 'build',
status: 'in_progress',
conclusion: null,
html_url: '',
details_url: null,
started_at: '2026-11-05T10:00:00Z',
completed_at: null
})
).toMatchObject({ startedAt: '2026-11-05T10:00:00Z' })
expect(
mapRestCommitStatus({
context: 'jenkins',
state: 'success',
created_at: '2026-11-05T09:00:00Z'
})
).toMatchObject({ completedAt: '2026-11-05T09:00:00Z' })
})
})