|
1 | 1 | import { describe, it, expect, beforeEach, afterEach } from 'bun:test' |
2 | 2 | import { startWebServer, stopWebServer, getServerUrl } from '../src/web/server/server.ts' |
3 | | -import { PTYManager } from '../src/plugin/pty/manager.ts' |
4 | 3 | import { manager } from '../src/plugin/pty/manager.ts' |
5 | 4 |
|
6 | 5 | describe.serial('Web Server', () => { |
7 | | - const fakeClient = { |
8 | | - app: { |
9 | | - log: async (_opts: any) => { |
10 | | - // Mock logger - do nothing |
11 | | - }, |
12 | | - }, |
13 | | - } as any |
14 | | - |
15 | 6 | beforeEach(() => { |
16 | | - testManager = new PTYManager() |
17 | | - testManager.init(fakeClient) |
| 7 | + // No setup needed for server lifecycle tests |
18 | 8 | }) |
19 | 9 |
|
20 | 10 | afterEach(() => { |
@@ -157,24 +147,6 @@ describe.serial('Web Server', () => { |
157 | 147 | expect(sessionData.args).toEqual(['1']) |
158 | 148 | }) |
159 | 149 |
|
160 | | - console.log('Created session:', session) |
161 | | - const fullSession = testManager.get(session.id) |
162 | | - console.log('Session from manager.get:', fullSession) |
163 | | - |
164 | | - // Wait for PTY to start |
165 | | - await new Promise((resolve) => setTimeout(resolve, 100)) |
166 | | - |
167 | | - const response = await fetch(`${serverUrl}/api/sessions/${session.id}`) |
168 | | - console.log('Session response status:', response.status) |
169 | | - expect(response.status).toBe(200) |
170 | | - |
171 | | - const sessionData = await response.json() |
172 | | - console.log('Session data:', sessionData) |
173 | | - expect(sessionData.id).toBe(session.id) |
174 | | - expect(sessionData.command).toBe('sleep') |
175 | | - expect(sessionData.args).toEqual(['1']) |
176 | | - }) |
177 | | - |
178 | 150 | it('should return 404 for non-existent session', async () => { |
179 | 151 | const nonexistentId = `nonexistent-${Math.random().toString(36).substr(2, 9)}` |
180 | 152 | console.log('Testing non-existent session ID:', nonexistentId) |
@@ -240,7 +212,7 @@ describe.serial('Web Server', () => { |
240 | 212 |
|
241 | 213 | it('should return session output', async () => { |
242 | 214 | // Create a session that produces output |
243 | | - const session = testManager.spawn({ |
| 215 | + const session = manager.spawn({ |
244 | 216 | command: 'sh', |
245 | 217 | args: ['-c', 'echo "line1"; echo "line2"; echo "line3"'], |
246 | 218 | description: 'Test session with output', |
|
0 commit comments