@@ -28,7 +28,7 @@ describe("useAgentLogs", () => {
28
28
expect ( wsSpy ) . not . toHaveBeenCalled ( ) ;
29
29
} ) ;
30
30
31
- it ( "should return existing logs without network calls" , async ( ) => {
31
+ it ( "should return existing logs without network calls if state is off " , async ( ) => {
32
32
const queryClient = createTestQueryClient ( ) ;
33
33
queryClient . setQueryData (
34
34
agentLogsKey ( MockWorkspace . id , MockWorkspaceAgent . id ) ,
@@ -39,7 +39,7 @@ describe("useAgentLogs", () => {
39
39
const { result } = renderUseAgentLogs ( queryClient , {
40
40
workspaceId : MockWorkspace . id ,
41
41
agentId : MockWorkspaceAgent . id ,
42
- agentLifeCycleState : "ready " ,
42
+ agentLifeCycleState : "off " ,
43
43
} ) ;
44
44
await waitFor ( ( ) => {
45
45
expect ( result . current ) . toHaveLength ( 5 ) ;
@@ -48,12 +48,12 @@ describe("useAgentLogs", () => {
48
48
expect ( wsSpy ) . not . toHaveBeenCalled ( ) ;
49
49
} ) ;
50
50
51
- it ( "should fetch logs when empty and should not connect to WebSocket when not starting " , async ( ) => {
51
+ it ( "should fetch logs when empty" , async ( ) => {
52
52
const queryClient = createTestQueryClient ( ) ;
53
53
const fetchSpy = jest
54
54
. spyOn ( API , "getWorkspaceAgentLogs" )
55
55
. mockResolvedValueOnce ( generateLogs ( 5 ) ) ;
56
- const wsSpy = jest . spyOn ( APIModule , "watchWorkspaceAgentLogs" ) ;
56
+ jest . spyOn ( APIModule , "watchWorkspaceAgentLogs" ) ;
57
57
const { result } = renderUseAgentLogs ( queryClient , {
58
58
workspaceId : MockWorkspace . id ,
59
59
agentId : MockWorkspaceAgent . id ,
@@ -63,10 +63,9 @@ describe("useAgentLogs", () => {
63
63
expect ( result . current ) . toHaveLength ( 5 ) ;
64
64
} ) ;
65
65
expect ( fetchSpy ) . toHaveBeenCalledWith ( MockWorkspaceAgent . id ) ;
66
- expect ( wsSpy ) . not . toHaveBeenCalled ( ) ;
67
66
} ) ;
68
67
69
- it ( "should fetch logs and connect to websocket when agent is starting " , async ( ) => {
68
+ it ( "should fetch logs and connect to websocket" , async ( ) => {
70
69
const queryClient = createTestQueryClient ( ) ;
71
70
const logs = generateLogs ( 5 ) ;
72
71
const fetchSpy = jest
0 commit comments