@@ -57,6 +57,37 @@ describe('Documents tests', () => {
5757 }
5858 } )
5959
60+ test ( `${ permission } key: Get one document ` , async ( ) => {
61+ const client = await getClient ( permission )
62+ const { taskUid } = await client
63+ . index ( indexNoPk . uid )
64+ . addDocuments ( dataset )
65+ await client . index ( indexNoPk . uid ) . waitForTask ( taskUid )
66+
67+ const documentId = 1
68+ const document = await client
69+ . index ( indexNoPk . uid )
70+ . getDocument < Book > ( documentId )
71+
72+ expect ( document . title ) . toEqual ( 'Alice In Wonderland' )
73+ } )
74+
75+ test ( `${ permission } key: Get one document with fields parameter` , async ( ) => {
76+ const client = await getClient ( permission )
77+ const { taskUid } = await client
78+ . index ( indexNoPk . uid )
79+ . addDocuments ( dataset )
80+ await client . index ( indexNoPk . uid ) . waitForTask ( taskUid )
81+
82+ const documentId = 1
83+ const document = await client
84+ . index ( indexNoPk . uid )
85+ . getDocument < Book > ( documentId , { fields : [ 'title' ] } )
86+
87+ expect ( document . title ) . toEqual ( 'Alice In Wonderland' )
88+ expect ( document . id ) . toBeUndefined ( )
89+ } )
90+
6091 test ( `${ permission } key: Get documents with string fields` , async ( ) => {
6192 const client = await getClient ( permission )
6293
@@ -136,10 +167,10 @@ describe('Documents tests', () => {
136167
137168 test ( `${ permission } key: Replace documents from index that has NO primary key` , async ( ) => {
138169 const client = await getClient ( permission )
139- const { taskUid : addDocUpdate } = await client
170+ const { taskUid : addDocTask } = await client
140171 . index ( indexNoPk . uid )
141172 . addDocuments ( dataset )
142- await client . index ( indexNoPk . uid ) . waitForTask ( addDocUpdate )
173+ await client . index ( indexNoPk . uid ) . waitForTask ( addDocTask )
143174 const id = 2
144175 const title = 'The Red And The Black'
145176
@@ -248,10 +279,10 @@ describe('Documents tests', () => {
248279
249280 test ( `${ permission } key: Add document with update documents function from index that has NO primary key` , async ( ) => {
250281 const client = await getClient ( permission )
251- const { taskUid : addDocUpdate } = await client
282+ const { taskUid : addDocTask } = await client
252283 . index ( indexNoPk . uid )
253284 . addDocuments ( dataset )
254- await client . index ( indexNoPk . uid ) . waitForTask ( addDocUpdate )
285+ await client . index ( indexNoPk . uid ) . waitForTask ( addDocTask )
255286 const id = 9
256287 const title = '1984'
257288
@@ -269,10 +300,10 @@ describe('Documents tests', () => {
269300
270301 test ( `${ permission } key: Add document with update documents function from index that has a primary key` , async ( ) => {
271302 const client = await getClient ( permission )
272- const { taskUid : addDocUpdate } = await client
303+ const { taskUid : addDocTask } = await client
273304 . index ( indexPk . uid )
274305 . addDocuments ( dataset )
275- await client . index ( indexPk . uid ) . waitForTask ( addDocUpdate )
306+ await client . index ( indexPk . uid ) . waitForTask ( addDocTask )
276307 const id = 9
277308 const title = '1984'
278309 const task = await client
@@ -290,10 +321,10 @@ describe('Documents tests', () => {
290321
291322 test ( `${ permission } key: Delete a document from index that has NO primary key` , async ( ) => {
292323 const client = await getClient ( permission )
293- const { taskUid : addDocUpdate } = await client
324+ const { taskUid : addDocTask } = await client
294325 . index ( indexNoPk . uid )
295326 . addDocuments ( dataset )
296- await client . index ( indexNoPk . uid ) . waitForTask ( addDocUpdate )
327+ await client . index ( indexNoPk . uid ) . waitForTask ( addDocTask )
297328 const id = 9
298329
299330 const task = await client . index ( indexNoPk . uid ) . deleteDocument ( id )
@@ -305,10 +336,10 @@ describe('Documents tests', () => {
305336
306337 test ( `${ permission } key: Delete a document from index that has a primary key` , async ( ) => {
307338 const client = await getClient ( permission )
308- const { taskUid : addDocUpdate } = await client
339+ const { taskUid : addDocTask } = await client
309340 . index ( indexPk . uid )
310341 . addDocuments ( dataset )
311- await client . index ( indexPk . uid ) . waitForTask ( addDocUpdate )
342+ await client . index ( indexPk . uid ) . waitForTask ( addDocTask )
312343
313344 const id = 9
314345 const task = await client . index ( indexPk . uid ) . deleteDocument ( id )
@@ -320,10 +351,10 @@ describe('Documents tests', () => {
320351
321352 test ( `${ permission } key: Delete some documents from index that has NO primary key` , async ( ) => {
322353 const client = await getClient ( permission )
323- const { taskUid : addDocUpdate } = await client
354+ const { taskUid : addDocTask } = await client
324355 . index ( indexNoPk . uid )
325356 . addDocuments ( dataset )
326- await client . index ( indexNoPk . uid ) . waitForTask ( addDocUpdate )
357+ await client . index ( indexNoPk . uid ) . waitForTask ( addDocTask )
327358
328359 const ids = [ 1 , 2 ]
329360 const task = await client . index ( indexNoPk . uid ) . deleteDocuments ( ids )
@@ -339,10 +370,10 @@ describe('Documents tests', () => {
339370
340371 test ( `${ permission } key: Delete some documents from index that has a primary key` , async ( ) => {
341372 const client = await getClient ( permission )
342- const { taskUid : addDocUpdate } = await client
373+ const { taskUid : addDocTask } = await client
343374 . index ( indexPk . uid )
344375 . addDocuments ( dataset )
345- await client . index ( indexPk . uid ) . waitForTask ( addDocUpdate )
376+ await client . index ( indexPk . uid ) . waitForTask ( addDocTask )
346377
347378 const ids = [ 1 , 2 ]
348379 const task = await client . index ( indexPk . uid ) . deleteDocuments ( ids )
@@ -410,7 +441,7 @@ describe('Documents tests', () => {
410441 expect ( response ) . toHaveProperty ( 'primaryKey' , 'unique' )
411442 } )
412443
413- test ( `${ permission } key: Add a document without a primary key and check response in update status` , async ( ) => {
444+ test ( `${ permission } key: Add a document without a primary key and check response in task status` , async ( ) => {
414445 const client = await getClient ( permission )
415446 const docs = [
416447 {
@@ -427,7 +458,7 @@ describe('Documents tests', () => {
427458 expect ( error ) . toHaveProperty ( 'type' )
428459 } )
429460
430- test ( `${ permission } key: Try to add documents from index with no primary key with NO valid primary key, update should fail` , async ( ) => {
461+ test ( `${ permission } key: Try to add documents from index with no primary key with NO valid primary key, task should fail` , async ( ) => {
431462 const client = await getClient ( permission )
432463 const { taskUid } = await client . index ( indexNoPk . uid ) . addDocuments ( [
433464 {
0 commit comments