From 1c687245eb92ea02179e52ecd979e44e3f611ba8 Mon Sep 17 00:00:00 2001 From: SandhraSokhal Date: Tue, 10 Dec 2024 08:12:34 -0800 Subject: [PATCH] Test for PLFM-8627 --- .../AgentChatWorkerIntegrationTest.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/services/workers/src/test/java/org/sagebionetworks/agent/worker/AgentChatWorkerIntegrationTest.java b/services/workers/src/test/java/org/sagebionetworks/agent/worker/AgentChatWorkerIntegrationTest.java index caffc3166c..36039220c4 100644 --- a/services/workers/src/test/java/org/sagebionetworks/agent/worker/AgentChatWorkerIntegrationTest.java +++ b/services/workers/src/test/java/org/sagebionetworks/agent/worker/AgentChatWorkerIntegrationTest.java @@ -193,6 +193,30 @@ public void testGetEntityChildrenHandler() throws AssertionError, AsynchJobFaile } + @Test + public void testGetFunctionInformation() throws AssertionError, AsynchJobFailedException { + + AgentSession session = agentService.createSession(admin.getId(), + new CreateAgentSessionRequest().setAgentAccessLevel(AgentAccessLevel.READ_YOUR_PRIVATE_DATA)); + + assertNotNull(session); + + String chatRequest = "what functions are available to you?"; + + //call under test + asynchronousJobWorkerHelper.assertJobResponse(admin, + new AgentChatRequest().setSessionId(session.getSessionId()).setChatText(chatRequest), + (AgentChatResponse response) -> { + assertNotNull(response); + assertEquals(session.getSessionId(), response.getSessionId()); + assertTrue(response.getResponseText().contains("search")); + assertTrue(response.getResponseText().contains("get_description")); + assertTrue(response.getResponseText().contains("get_entity_metadata")); + assertTrue(response.getResponseText().contains("get_entity_children")); + }, MAX_WAIT_MS).getResponse(); + + } + @Test public void testGetFolderAndFileEntityChildren() throws AssertionError, AsynchJobFailedException, IOException { Project project = entityService.createEntity(admin.getId(), new Project().setName(UUID.randomUUID().toString()),