Skip to content

Commit 2f4d970

Browse files
committed
fix: correct test file syntax and remove unused code
- Remove duplicate test code and unused variables - Fix testManager references to use global manager - Remove unused imports and variables
1 parent 76d9d9b commit 2f4d970

1 file changed

Lines changed: 2 additions & 30 deletions

File tree

test/web-server.test.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
import { describe, it, expect, beforeEach, afterEach } from 'bun:test'
22
import { startWebServer, stopWebServer, getServerUrl } from '../src/web/server/server.ts'
3-
import { PTYManager } from '../src/plugin/pty/manager.ts'
43
import { manager } from '../src/plugin/pty/manager.ts'
54

65
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-
156
beforeEach(() => {
16-
testManager = new PTYManager()
17-
testManager.init(fakeClient)
7+
// No setup needed for server lifecycle tests
188
})
199

2010
afterEach(() => {
@@ -157,24 +147,6 @@ describe.serial('Web Server', () => {
157147
expect(sessionData.args).toEqual(['1'])
158148
})
159149

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-
178150
it('should return 404 for non-existent session', async () => {
179151
const nonexistentId = `nonexistent-${Math.random().toString(36).substr(2, 9)}`
180152
console.log('Testing non-existent session ID:', nonexistentId)
@@ -240,7 +212,7 @@ describe.serial('Web Server', () => {
240212

241213
it('should return session output', async () => {
242214
// Create a session that produces output
243-
const session = testManager.spawn({
215+
const session = manager.spawn({
244216
command: 'sh',
245217
args: ['-c', 'echo "line1"; echo "line2"; echo "line3"'],
246218
description: 'Test session with output',

0 commit comments

Comments
 (0)