Skip to content

Commit 18cb7e4

Browse files
Remove console logs, try-catch, and redundant tests from agents test
Co-authored-by: Netanel Gilad <netanelgilad@users.noreply.github.com>
1 parent 66541dc commit 18cb7e4

1 file changed

Lines changed: 5 additions & 52 deletions

File tree

tests/unit/agents.test.ts

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,12 @@ describe("Agents Module", () => {
7979

8080
const filterParams = { limit: 10, skip: 0 };
8181

82-
// Debug: Check if agents module exists
83-
console.log("base44.agents:", !!base44.agents);
84-
console.log(
85-
"base44.agents.listConversations:",
86-
typeof base44.agents?.listConversations
87-
);
8882

89-
try {
90-
const result = await base44.agents.listConversations(filterParams);
91-
console.log("result:", result);
92-
93-
// Check if result is the expected value
94-
expect(result).toEqual(mockConversations);
95-
// expect(scope.isDone()).toBe(true);
96-
} catch (error) {
97-
console.log("Error occurred:", error);
98-
throw error;
99-
}
83+
const result = await base44.agents.listConversations(filterParams);
84+
85+
// Check if result is the expected value
86+
expect(result).toEqual(mockConversations);
87+
// expect(scope.isDone()).toBe(true);
10088
});
10189

10290
it("should fetch conversations without filter params", async () => {
@@ -307,42 +295,7 @@ describe("Agents Module", () => {
307295
// Don't test connected status as it depends on mock WebSocket implementation
308296
});
309297

310-
it("should allow subscription when WebSocket is enabled", () => {
311-
const conversationId = "conv-123";
312-
const onUpdate = vi.fn();
313-
314-
// This should not throw an error
315-
expect(() => {
316-
const unsubscribe = base44WithWS.agents.subscribeToConversation(
317-
conversationId,
318-
onUpdate
319-
);
320-
expect(typeof unsubscribe).toBe("function");
321-
}).not.toThrow();
322-
});
323-
324-
it("should handle WebSocket connection attempt", async () => {
325-
// This test just verifies that connectWebSocket doesn't throw an error
326-
// when WebSocket is available
327-
expect(() => {
328-
base44WithWS.agents.connectWebSocket().catch(() => {
329-
// Ignore connection errors in tests
330-
});
331-
}).not.toThrow();
332-
});
333298

334-
it("should handle subscription without throwing errors", () => {
335-
const conversationId = "conv-123";
336-
const onUpdate = vi.fn();
337299

338-
// This should work without throwing errors
339-
expect(() => {
340-
const unsubscribe = base44WithWS.agents.subscribeToConversation(
341-
conversationId,
342-
onUpdate
343-
);
344-
unsubscribe(); // Test unsubscribe as well
345-
}).not.toThrow();
346-
});
347300
});
348301
});

0 commit comments

Comments
 (0)