@@ -11,6 +11,8 @@ vi.mock('@/lib/internal/oci-document-understanding/operations', () => ({
1111import { OciClientError } from '@/lib/internal/oci/errors'
1212import { executeOciDocumentTool } from '@/lib/internal/oci-document-understanding/execute-tool'
1313import type { InternalToolOperationCall } from '@/lib/internal/tool-operations/types'
14+ import { OciDocumentUnderstandingBlock } from '@/blocks/blocks/oci_document_understanding'
15+ import { ociDocumentListModelsTool } from '@/tools/oci_document_understanding/list_models'
1416import {
1517 documentOperationInput ,
1618 isDocumentJsonWithinLimit ,
@@ -39,6 +41,42 @@ describe('document internal tool boundary', () => {
3941 executeOperation . mockResolvedValue ( { success : true , output : { } } )
4042 } )
4143
44+ it . each ( [ null , '' , undefined , 'project-1' ] ) (
45+ 'normalizes an optional project filter through the native block merge (%s)' ,
46+ async ( projectId ) => {
47+ const raw = {
48+ operation : ociDocumentListModelsTool . id ,
49+ oauthCredential : 'selected' ,
50+ compartmentId : 'compartment-1' ,
51+ projectId,
52+ displayName : null ,
53+ page : '' ,
54+ limit : '10' ,
55+ }
56+ const params = {
57+ ...raw ,
58+ ...OciDocumentUnderstandingBlock . tools . config ?. params ?.( raw ) ,
59+ accessToken : 'authorized' ,
60+ }
61+ const response = await executeOciDocumentTool (
62+ request ( 'list_models' , ociDocumentListModelsTool . operation . input ( params ) )
63+ )
64+ expect ( response . status ) . toBe ( 200 )
65+ expect ( executeOperation ) . toHaveBeenCalledWith (
66+ expect . objectContaining ( {
67+ operation : 'list_models' ,
68+ credentialId : 'authorized' ,
69+ compartmentId : 'compartment-1' ,
70+ limit : 10 ,
71+ } ) ,
72+ expect . anything ( )
73+ )
74+ expect ( executeOperation . mock . lastCall ?. [ 0 ] . projectId ) . toBe ( projectId || undefined )
75+ expect ( executeOperation . mock . lastCall ?. [ 0 ] . displayName ) . toBeUndefined ( )
76+ expect ( executeOperation . mock . lastCall ?. [ 0 ] . page ) . toBeUndefined ( )
77+ }
78+ )
79+
4280 it . each ( [
4381 [ 'analyze_document' , analysisInput ] ,
4482 [
0 commit comments