fix: job edit schedule format error and refactor services directory
- Fix #25: job update sends schedule as plain string but upstream expects { kind, expr, display } object, causing "'str' object has no attribute 'get'" - Move hermes-cli.ts, hermes.ts, hermes-profile.ts into services/hermes/ for multi-agent namespacing consistency - Fix ts-node Set spread compatibility in filesystem.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
|
||||
// Mock hermes-cli
|
||||
vi.mock('../../packages/server/src/services/hermes-cli', () => ({
|
||||
vi.mock('../../packages/server/src/services/hermes/hermes-cli', () => ({
|
||||
listProfiles: vi.fn(),
|
||||
getProfile: vi.fn(),
|
||||
createProfile: vi.fn(),
|
||||
@@ -16,7 +16,7 @@ vi.mock('../../packages/server/src/services/hermes-cli', () => ({
|
||||
importProfile: vi.fn(),
|
||||
}))
|
||||
|
||||
import * as hermesCli from '../../packages/server/src/services/hermes-cli'
|
||||
import * as hermesCli from '../../packages/server/src/services/hermes/hermes-cli'
|
||||
|
||||
describe('Profile Routes', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -120,7 +120,15 @@ describe('Proxy Handler', () => {
|
||||
})
|
||||
|
||||
it('returns 502 on connection failure', async () => {
|
||||
mockFetch.mockRejectedValue(new Error('ECONNREFUSED'))
|
||||
// waitForGatewayReady loops calling fetch(healthUrl) until res.ok or timeout.
|
||||
// Return ok:true for health checks so the loop exits immediately (gateway
|
||||
// "ready"), then the retry fetch also fails with ECONNREFUSED → 502.
|
||||
mockFetch.mockImplementation((url: string) => {
|
||||
if (typeof url === 'string' && url.includes('/health')) {
|
||||
return Promise.resolve({ ok: true })
|
||||
}
|
||||
return Promise.reject(new Error('ECONNREFUSED'))
|
||||
})
|
||||
|
||||
const ctx = createMockCtx()
|
||||
await proxy(ctx)
|
||||
|
||||
Reference in New Issue
Block a user