File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,41 @@ describe.each([
6767 } )
6868 await client . getIndex ( uidAndPrimaryKey . uid ) . waitForPendingUpdate ( updateId )
6969 } )
70+ test ( `${ permission } key: Get documents with string attributesToRetrieve` , async ( ) => {
71+ await client
72+ . getIndex ( uidNoPrimaryKey . uid )
73+ . getDocuments ( {
74+ attributesToRetrieve : 'id' ,
75+ } )
76+ . then ( ( response ) => {
77+ expect ( response . find ( ( x ) => Object . keys ( x ) . length !== 1 ) ) . toEqual (
78+ undefined
79+ )
80+ } )
81+ } )
82+
83+ test ( `${ permission } key: Get documents with array attributesToRetrieve` , async ( ) => {
84+ await client
85+ . getIndex ( uidNoPrimaryKey . uid )
86+ . getDocuments ( {
87+ attributesToRetrieve : [ 'id' ] ,
88+ } )
89+ . then ( ( response ) => {
90+ expect ( response . find ( ( x ) => Object . keys ( x ) . length !== 1 ) ) . toEqual (
91+ undefined
92+ )
93+ } )
94+ } )
95+
7096 test ( `${ permission } key: Get documents from index that has no primary key` , async ( ) => {
7197 await client
7298 . getIndex ( uidNoPrimaryKey . uid )
73- . getDocuments ( )
99+ . getDocuments ( {
100+ attributesToRetrieve : 'id' ,
101+ } )
74102 . then ( ( response ) => {
103+ console . log ( { response } )
104+
75105 expect ( response . length ) . toEqual ( dataset . length )
76106 } )
77107 } )
@@ -83,6 +113,7 @@ describe.each([
83113 expect ( response . length ) . toEqual ( dataset . length )
84114 } )
85115 } )
116+
86117 test ( `${ permission } key: Replace documents from index that has NO primary key` , async ( ) => {
87118 const id = 2
88119 const title = 'The Red And The Black'
You can’t perform that action at this time.
0 commit comments