@@ -680,17 +680,13 @@ describe("Documents tests", () => {
680
680
test ( `${ permission } key: test updateDocumentsByFunction` , async ( ) => {
681
681
const client = await getClient ( permission ) ;
682
682
const index = client . index < ( typeof dataset ) [ number ] > ( indexPk . uid ) ;
683
- const adminKey = await getKey ( "Admin" ) ;
684
683
685
684
await index . updateFilterableAttributes ( [ "id" ] ) . waitTask ( ) ;
686
685
687
- await fetch ( `${ HOST } /experimental-features` , {
688
- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
689
- headers : {
690
- Authorization : `Bearer ${ adminKey } ` ,
691
- "Content-Type" : "application/json" ,
692
- } ,
693
- method : "PATCH" ,
686
+ await (
687
+ await getClient ( "Master" )
688
+ ) . updateExperimentalFeatures ( {
689
+ editDocumentsByFunction : true ,
694
690
} ) ;
695
691
696
692
await index . addDocuments ( dataset ) . waitTask ( ) ;
@@ -761,15 +757,11 @@ describe("Documents tests", () => {
761
757
762
758
test ( `${ permission } key: Try updateDocumentsByFunction and be denied` , async ( ) => {
763
759
const client = await getClient ( permission ) ;
764
- const adminKey = await getKey ( "Admin" ) ;
765
760
766
- await fetch ( `${ HOST } /experimental-features` , {
767
- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
768
- headers : {
769
- Authorization : `Bearer ${ adminKey } ` ,
770
- "Content-Type" : "application/json" ,
771
- } ,
772
- method : "PATCH" ,
761
+ await (
762
+ await getClient ( "Master" )
763
+ ) . updateExperimentalFeatures ( {
764
+ editDocumentsByFunction : true ,
773
765
} ) ;
774
766
775
767
await expect (
@@ -848,15 +840,11 @@ describe("Documents tests", () => {
848
840
849
841
test ( `${ permission } key: Try updateDocumentsByFunction and be denied` , async ( ) => {
850
842
const client = await getClient ( permission ) ;
851
- const adminKey = await getKey ( "Admin" ) ;
852
843
853
- await fetch ( `${ HOST } /experimental-features` , {
854
- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
855
- headers : {
856
- Authorization : `Bearer ${ adminKey } ` ,
857
- "Content-Type" : "application/json" ,
858
- } ,
859
- method : "PATCH" ,
844
+ await (
845
+ await getClient ( "Master" )
846
+ ) . updateExperimentalFeatures ( {
847
+ editDocumentsByFunction : true ,
860
848
} ) ;
861
849
862
850
await expect (
@@ -962,15 +950,11 @@ describe("Documents tests", () => {
962
950
const route = `indexes/${ indexPk . uid } /documents/edit` ;
963
951
const client = new MeiliSearch ( { host } ) ;
964
952
const strippedHost = trailing ? host . slice ( 0 , - 1 ) : host ;
965
- const adminKey = await getKey ( "Admin" ) ;
966
-
967
- await fetch ( `${ HOST } /experimental-features` , {
968
- body : JSON . stringify ( { editDocumentsByFunction : true } ) ,
969
- headers : {
970
- Authorization : `Bearer ${ adminKey } ` ,
971
- "Content-Type" : "application/json" ,
972
- } ,
973
- method : "PATCH" ,
953
+
954
+ await (
955
+ await getClient ( "Master" )
956
+ ) . updateExperimentalFeatures ( {
957
+ editDocumentsByFunction : true ,
974
958
} ) ;
975
959
976
960
await expect (
0 commit comments