@@ -5,15 +5,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
55import { clearAtlassianCloudIdCache } from '@/lib/atlassian/discovery'
66import { createConfluenceClient } from '@/lib/internal/confluence/client'
77import { createJiraClient } from '@/lib/internal/jira/client'
8- import {
9- assertAssistantIntegrationCall ,
10- isAssistantIntegrationTool ,
11- } from '@/lib/mothership/assistant/tool-policy'
8+ import { assertAssistantIntegrationCall } from '@/lib/mothership/assistant/tool-policy'
129import { getToolMetadata } from '@/tools/metadata'
13- import { getToolIds } from '@/tools/tool-ids'
1410
1511vi . unmock ( '@/tools/metadata' )
16- vi . unmock ( '@/tools/tool-ids' )
1712
1813const CLOUD_ID = '12345678-1234-1234-1234-123456789012'
1914const OTHER_CLOUD_ID = '12345678-1234-1234-1234-123456789013'
@@ -32,29 +27,21 @@ describe('Atlassian Assistant resource selection', () => {
3227
3328 afterEach ( ( ) => vi . unstubAllGlobals ( ) )
3429
35- it . each ( [ 'jira' , 'confluence' ] ) (
36- 'offers %s operations with a site selector and personal credential' ,
37- ( service ) => {
38- const tools = getToolIds ( )
39- . filter ( ( id ) => id . startsWith ( `${ service } _` ) )
40- . map ( ( id ) => getToolMetadata ( id ) )
41- . filter ( ( tool ) => tool ?. params . domain )
42- expect ( tools . length ) . toBeGreaterThan ( 0 )
43- for ( const tool of tools ) {
44- expect ( tool ?. params . domain . visibility , tool ?. id ) . toBe ( 'user-or-llm' )
45- expect ( isAssistantIntegrationTool ( tool ) , tool ?. id ) . toBe ( true )
30+ it . each ( [ 'jira_get_project' , 'confluence_list_spaces' ] ) (
31+ 'allows site selection for %s without accepting credential overrides' ,
32+ ( toolId ) => {
33+ const tool = getToolMetadata ( toolId )
34+ expect ( ( ) =>
35+ assertAssistantIntegrationCall ( tool , { credentialId : 'mine' , domain : DOMAIN } )
36+ ) . not . toThrow ( )
37+ for ( const name of [ 'cloudId' , 'accessToken' , '_context' ] ) {
4638 expect ( ( ) =>
47- assertAssistantIntegrationCall ( tool , { credentialId : 'mine' , domain : DOMAIN } )
48- ) . not . toThrow ( )
49- for ( const name of [ 'cloudId' , 'accessToken' , '_context' ] ) {
50- expect ( ( ) =>
51- assertAssistantIntegrationCall ( tool , {
52- credentialId : 'mine' ,
53- domain : DOMAIN ,
54- [ name ] : 'override' ,
55- } )
56- ) . toThrow ( )
57- }
39+ assertAssistantIntegrationCall ( tool , {
40+ credentialId : 'mine' ,
41+ domain : DOMAIN ,
42+ [ name ] : 'override' ,
43+ } )
44+ ) . toThrow ( )
5845 }
5946 }
6047 )
0 commit comments