mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix: apply CodeRabbit auto-fixes
This commit is contained in:
1 parent
3e6ebbd1dc
commit
8d92f86142
10 files changed
+262
-28
No files matched your search
@@ -362,6 +362,28 @@ describe('probeOpenCodeServer', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unauthorized when the server rejects the credentials with an empty body', async () => {
|
||||
const server = await startProbeServer((_request, response) => {
|
||||
response.writeHead(401, { 'content-type': 'text/plain' })
|
||||
response.end()
|
||||
})
|
||||
|
||||
await expect(probeOpenCodeServer(server.baseUrl, CREDENTIALS, 1000)).resolves.toEqual({
|
||||
status: 'unauthorized',
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unauthorized when the server rejects the credentials with a plain text body', async () => {
|
||||
const server = await startProbeServer((_request, response) => {
|
||||
response.writeHead(401, { 'content-type': 'text/plain' })
|
||||
response.end('unauthorized')
|
||||
})
|
||||
|
||||
await expect(probeOpenCodeServer(server.baseUrl, CREDENTIALS, 1000)).resolves.toEqual({
|
||||
status: 'unauthorized',
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unreachable with the HTTP status for an unexpected response', async () => {
|
||||
const server = await startProbeServer((_request, response) => {
|
||||
response.writeHead(500, { 'content-type': 'application/json' })
|
||||
@@ -374,6 +396,18 @@ describe('probeOpenCodeServer', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unreachable with the HTTP status for an unexpected plain text response', async () => {
|
||||
const server = await startProbeServer((_request, response) => {
|
||||
response.writeHead(500, { 'content-type': 'text/plain' })
|
||||
response.end('boom')
|
||||
})
|
||||
|
||||
await expect(probeOpenCodeServer(server.baseUrl, CREDENTIALS, 1000)).resolves.toEqual({
|
||||
status: 'unreachable',
|
||||
message: 'HTTP 500',
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unreachable when the server refuses the connection', async () => {
|
||||
const server = await startProbeServer(() => {})
|
||||
const baseUrl = server.baseUrl
|
||||
|
||||
Reference in new issue
Block a user