@@ -681,17 +681,13 @@ describe("Documents tests", () => {
681681 test ( `${ permission } key: test updateDocumentsByFunction` , async ( ) => {
682682 const client = await getClient ( permission ) ;
683683 const index = client . index < ( typeof dataset ) [ number ] > ( indexPk . uid ) ;
684- const adminKey = await getKey ( "Admin" ) ;
685684
686685 await index . updateFilterableAttributes ( [ "id" ] ) . waitTask ( ) ;
687686
688- await fetch ( `${ HOST } /experimental-features` , {
689- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
690- headers : {
691- Authorization : `Bearer ${ adminKey } ` ,
692- "Content-Type" : "application/json" ,
693- } ,
694- method : "PATCH" ,
687+ await (
688+ await getClient ( "Master" )
689+ ) . updateExperimentalFeatures ( {
690+ editDocumentsByFunction : true ,
695691 } ) ;
696692
697693 await index . addDocuments ( dataset ) . waitTask ( ) ;
@@ -762,15 +758,11 @@ describe("Documents tests", () => {
762758
763759 test ( `${ permission } key: Try updateDocumentsByFunction and be denied` , async ( ) => {
764760 const client = await getClient ( permission ) ;
765- const adminKey = await getKey ( "Admin" ) ;
766761
767- await fetch ( `${ HOST } /experimental-features` , {
768- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
769- headers : {
770- Authorization : `Bearer ${ adminKey } ` ,
771- "Content-Type" : "application/json" ,
772- } ,
773- method : "PATCH" ,
762+ await (
763+ await getClient ( "Master" )
764+ ) . updateExperimentalFeatures ( {
765+ editDocumentsByFunction : true ,
774766 } ) ;
775767
776768 await expect (
@@ -849,15 +841,11 @@ describe("Documents tests", () => {
849841
850842 test ( `${ permission } key: Try updateDocumentsByFunction and be denied` , async ( ) => {
851843 const client = await getClient ( permission ) ;
852- const adminKey = await getKey ( "Admin" ) ;
853844
854- await fetch ( `${ HOST } /experimental-features` , {
855- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
856- headers : {
857- Authorization : `Bearer ${ adminKey } ` ,
858- "Content-Type" : "application/json" ,
859- } ,
860- method : "PATCH" ,
845+ await (
846+ await getClient ( "Master" )
847+ ) . updateExperimentalFeatures ( {
848+ editDocumentsByFunction : true ,
861849 } ) ;
862850
863851 await expect (
@@ -963,15 +951,11 @@ describe("Documents tests", () => {
963951 const route = `indexes/${ indexPk . uid } /documents/edit` ;
964952 const client = new MeiliSearch ( { host } ) ;
965953 const strippedHost = trailing ? host . slice ( 0 , - 1 ) : host ;
966- const adminKey = await getKey ( "Admin" ) ;
967-
968- await fetch ( `${ HOST } /experimental-features` , {
969- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
970- headers : {
971- Authorization : `Bearer ${ adminKey } ` ,
972- "Content-Type" : "application/json" ,
973- } ,
974- method : "PATCH" ,
954+
955+ await (
956+ await getClient ( "Master" )
957+ ) . updateExperimentalFeatures ( {
958+ editDocumentsByFunction : true ,
975959 } ) ;
976960
977961 await expect (
0 commit comments