feat: update docker-compose to use GHCR images and fix test failures
- Update docker-compose.yml to use ghcr.io/wikid82/caddyproxymanagerplus:latest - Update docker-compose.dev.yml to use ghcr.io/wikid82/caddyproxymanagerplus:dev - Fix backend test database isolation (remove shared cache mode) - Add testConnection and enabledServers to useRemoteServers hook - Fix frontend test assertions to wait for async state updates - Wrap mutation assertions in waitFor for proper async handling Backend tests: ✅ ALL PASSING (22 tests) Frontend tests: ⚠️ 45/49 passing (4 useImport tests need mock refinement)
This commit is contained in:
@@ -75,7 +75,9 @@ describe('useProxyHosts', () => {
|
||||
await result.current.createHost(newHost)
|
||||
|
||||
expect(api.proxyHostsAPI.create).toHaveBeenCalledWith(newHost)
|
||||
expect(api.proxyHostsAPI.list).toHaveBeenCalledTimes(2) // Initial load + reload after create
|
||||
await waitFor(() => {
|
||||
expect(result.current.hosts).toContainEqual(createdHost)
|
||||
})
|
||||
})
|
||||
|
||||
it('updates an existing proxy host', async () => {
|
||||
@@ -94,7 +96,9 @@ describe('useProxyHosts', () => {
|
||||
await result.current.updateHost('1', { domain_names: 'updated.com' })
|
||||
|
||||
expect(api.proxyHostsAPI.update).toHaveBeenCalledWith('1', { domain_names: 'updated.com' })
|
||||
expect(api.proxyHostsAPI.list).toHaveBeenCalledTimes(2)
|
||||
await waitFor(() => {
|
||||
expect(result.current.hosts[0].domain_names).toBe('updated.com')
|
||||
})
|
||||
})
|
||||
|
||||
it('deletes a proxy host', async () => {
|
||||
@@ -114,7 +118,10 @@ describe('useProxyHosts', () => {
|
||||
await result.current.deleteHost('1')
|
||||
|
||||
expect(api.proxyHostsAPI.delete).toHaveBeenCalledWith('1')
|
||||
expect(api.proxyHostsAPI.list).toHaveBeenCalledTimes(2)
|
||||
await waitFor(() => {
|
||||
expect(result.current.hosts).toHaveLength(1)
|
||||
expect(result.current.hosts[0].uuid).toBe('2')
|
||||
})
|
||||
})
|
||||
|
||||
it('handles create errors', async () => {
|
||||
|
||||
@@ -99,7 +99,9 @@ describe('useRemoteServers', () => {
|
||||
await result.current.createServer(newServer)
|
||||
|
||||
expect(api.remoteServersAPI.create).toHaveBeenCalledWith(newServer)
|
||||
expect(api.remoteServersAPI.list).toHaveBeenCalledTimes(2)
|
||||
await waitFor(() => {
|
||||
expect(result.current.servers).toContainEqual(createdServer)
|
||||
})
|
||||
})
|
||||
|
||||
it('updates an existing remote server', async () => {
|
||||
@@ -118,7 +120,9 @@ describe('useRemoteServers', () => {
|
||||
await result.current.updateServer('1', { name: 'Updated Server' })
|
||||
|
||||
expect(api.remoteServersAPI.update).toHaveBeenCalledWith('1', { name: 'Updated Server' })
|
||||
expect(api.remoteServersAPI.list).toHaveBeenCalledTimes(2)
|
||||
await waitFor(() => {
|
||||
expect(result.current.servers[0].name).toBe('Updated Server')
|
||||
})
|
||||
})
|
||||
|
||||
it('deletes a remote server', async () => {
|
||||
@@ -138,7 +142,10 @@ describe('useRemoteServers', () => {
|
||||
await result.current.deleteServer('1')
|
||||
|
||||
expect(api.remoteServersAPI.delete).toHaveBeenCalledWith('1')
|
||||
expect(api.remoteServersAPI.list).toHaveBeenCalledTimes(2)
|
||||
await waitFor(() => {
|
||||
expect(result.current.servers).toHaveLength(1)
|
||||
expect(result.current.servers[0].uuid).toBe('2')
|
||||
})
|
||||
})
|
||||
|
||||
it('tests server connection', async () => {
|
||||
|
||||
Reference in New Issue
Block a user