mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
test: remove 244 low-value tests (#39507)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -1,36 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { classifyGitHubUnavailable, isGitHubUnavailableError } from './api-availability'
|
||||
import { classifyGitHubUnavailable } from './api-availability'
|
||||
|
||||
describe('classifyGitHubUnavailable', () => {
|
||||
it('classifies HTTP 5xx outages as server_error', () => {
|
||||
expect(classifyGitHubUnavailable('HTTP 503: Service Unavailable')).toBe('server_error')
|
||||
expect(classifyGitHubUnavailable('gh: Command failed: HTTP 502 Bad Gateway')).toBe(
|
||||
'server_error'
|
||||
)
|
||||
expect(classifyGitHubUnavailable('GitHub API error: 500 Internal Server Error')).toBe(
|
||||
'server_error'
|
||||
)
|
||||
expect(classifyGitHubUnavailable('The service is temporarily unavailable')).toBe('server_error')
|
||||
})
|
||||
|
||||
it('classifies transport failures as network', () => {
|
||||
for (const message of [
|
||||
'request to https://api.github.com failed, reason: getaddrinfo ENOTFOUND api.github.com',
|
||||
'error connecting to api.github.com\ncheck your internet connection or GitHub status',
|
||||
'dial tcp: lookup api.github.com: no such host',
|
||||
'connect ETIMEDOUT 140.82.112.5:443',
|
||||
'TimeoutError: request aborted',
|
||||
'NetworkError when attempting to fetch resource',
|
||||
'network unavailable',
|
||||
'fetch failed',
|
||||
'socket hang up',
|
||||
'could not resolve host: api.github.com',
|
||||
'connection refused'
|
||||
]) {
|
||||
expect(classifyGitHubUnavailable(message)).toBe('network')
|
||||
}
|
||||
})
|
||||
|
||||
it('classifies rate limiting as rate_limited (even when it carries HTTP 403)', () => {
|
||||
expect(classifyGitHubUnavailable('HTTP 403: API rate limit exceeded')).toBe('rate_limited')
|
||||
expect(classifyGitHubUnavailable('You have exceeded a secondary rate limit')).toBe(
|
||||
@@ -56,12 +27,3 @@ describe('classifyGitHubUnavailable', () => {
|
||||
expect(classifyGitHubUnavailable('found 512 pull requests')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('isGitHubUnavailableError', () => {
|
||||
it('detects reachability failures from Error objects and strings', () => {
|
||||
expect(isGitHubUnavailableError(new Error('HTTP 503: Service Unavailable'))).toBe(true)
|
||||
expect(isGitHubUnavailableError('fetch failed')).toBe(true)
|
||||
expect(isGitHubUnavailableError(new Error('HTTP 404: Not Found'))).toBe(false)
|
||||
expect(isGitHubUnavailableError(null)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user