1- import { expectDefined , getResponseElements } from "../../helpers.js" ;
2- import { parseTable , describeWithAtlas , withProject } from "./atlasHelpers.js" ;
1+ import { expectDefined , getResponseContent } from "../../helpers.js" ;
2+ import { describeWithAtlas , withProject } from "./atlasHelpers.js" ;
33import { expect , it } from "vitest" ;
44
55describeWithAtlas ( "atlas-list-alerts" , ( integration ) => {
@@ -13,26 +13,20 @@ describeWithAtlas("atlas-list-alerts", (integration) => {
1313 } ) ;
1414
1515 withProject ( integration , ( { getProjectId } ) => {
16- it ( "returns alerts in table format" , async ( ) => {
16+ it ( "returns alerts in JSON format" , async ( ) => {
1717 const response = await integration . mcpClient ( ) . callTool ( {
1818 name : "atlas-list-alerts" ,
1919 arguments : { projectId : getProjectId ( ) } ,
2020 } ) ;
2121
22- const elements = getResponseElements ( response . content ) ;
23- expect ( elements ) . toHaveLength ( 1 ) ;
24-
25- const data = parseTable ( elements [ 0 ] ?. text ?? "" ) ;
26-
27- // Since we can't guarantee alerts will exist, we just verify the table structure
28- if ( data . length > 0 ) {
29- const alert = data [ 0 ] ;
30- expect ( alert ) . toHaveProperty ( "Alert ID" ) ;
31- expect ( alert ) . toHaveProperty ( "Status" ) ;
32- expect ( alert ) . toHaveProperty ( "Created" ) ;
33- expect ( alert ) . toHaveProperty ( "Updated" ) ;
34- expect ( alert ) . toHaveProperty ( "Type" ) ;
35- expect ( alert ) . toHaveProperty ( "Comment" ) ;
22+ const content = getResponseContent ( response . content ) ;
23+ // check that there are alerts or no alerts
24+ if ( content . includes ( "Found alerts in project" ) ) {
25+ expect ( content ) . toContain ( "<untrusted-user-data-" ) ;
26+ // expect projectId in the content
27+ expect ( content ) . toContain ( getProjectId ( ) ) ;
28+ } else {
29+ expect ( content ) . toContain ( "No alerts found" ) ;
3630 }
3731 } ) ;
3832 } ) ;
0 commit comments