@@ -71,6 +71,22 @@ describe.each([
7171 await client . index ( indexPk . uid ) . waitForPendingUpdate ( updateId )
7272 } )
7373
74+ test ( `${ permission } key: Add documents to uid with primary key in batch` , async ( ) => {
75+ const response : EnqueuedUpdate [ ] = await client
76+ . index ( indexPk . uid )
77+ . addDocumentsInBatch ( dataset , 4 )
78+ expect ( response ) . toBeInstanceOf ( Array )
79+ expect ( response ) . toHaveLength ( 2 )
80+ expect ( response [ 0 ] ) . toHaveProperty ( 'updateId' , expect . any ( Number ) )
81+ for ( const enqueuedUpdate of response ) {
82+ const addResponse = await client
83+ . index ( indexPk . uid )
84+ . waitForPendingUpdate ( enqueuedUpdate . updateId )
85+ expect ( addResponse . status ) . toBe ( 'processed' )
86+ expect ( addResponse . type . name ) . toBe ( 'DocumentsAddition' )
87+ }
88+ } )
89+
7490 test ( `${ permission } key: Get documents with string attributesToRetrieve` , async ( ) => {
7591 await client
7692 . index ( indexNoPk . uid )
@@ -208,6 +224,22 @@ describe.each([
208224 } )
209225 } )
210226
227+ test ( `${ permission } key: Update document from index that has a primary key in batch` , async ( ) => {
228+ const response : EnqueuedUpdate [ ] = await client
229+ . index ( indexPk . uid )
230+ . updateDocumentsInBatch ( dataset , 2 )
231+ expect ( response ) . toBeInstanceOf ( Array )
232+ expect ( response ) . toHaveLength ( 4 )
233+ expect ( response [ 0 ] ) . toHaveProperty ( 'updateId' , expect . any ( Number ) )
234+ for ( const enqueuedUpdate of response ) {
235+ const addResponse = await client
236+ . index ( indexPk . uid )
237+ . waitForPendingUpdate ( enqueuedUpdate . updateId )
238+ expect ( addResponse . status ) . toBe ( 'processed' )
239+ expect ( addResponse . type . name ) . toBe ( 'DocumentsPartial' )
240+ }
241+ } )
242+
211243 test ( `${ permission } key: Add document with update documents function from index that has NO primary key` , async ( ) => {
212244 const { updateId : addDocUpdate } = await client
213245 . index ( indexNoPk . uid )
0 commit comments