@@ -42,7 +42,7 @@ describe("execute mutation", function() {
4242 "String" : { }
4343 }
4444 } ;
45- const queryRequest : sdk . MutationRequest = {
45+ const mutationRequest : sdk . MutationRequest = {
4646 operations : [
4747 {
4848 type : "procedure" ,
@@ -56,7 +56,7 @@ describe("execute mutation", function() {
5656 collection_relationships : { }
5757 } ;
5858
59- const result = await executeMutation ( queryRequest , functionSchema , runtimeFunctions ) ;
59+ const result = await executeMutation ( mutationRequest , functionSchema , runtimeFunctions ) ;
6060 assert . deepStrictEqual ( result , {
6161 operation_results : [
6262 {
@@ -70,6 +70,70 @@ describe("execute mutation", function() {
7070 assert . equal ( functionCallCount , 1 ) ;
7171 } ) ;
7272
73+ it ( "blocks execution of multiple operations" , async function ( ) {
74+ let functionCallCount = 0 ;
75+ const runtimeFunctions = {
76+ "theFunction" : ( param : string ) => {
77+ functionCallCount ++ ;
78+ return `First function called with '${ param } '` ;
79+ }
80+ } ;
81+ const functionSchema : FunctionsSchema = {
82+ functions : {
83+ "theFunction" : {
84+ ndcKind : FunctionNdcKind . Procedure ,
85+ description : null ,
86+ parallelDegree : null ,
87+ arguments : [
88+ {
89+ argumentName : "param" ,
90+ description : null ,
91+ type : {
92+ type : "named" ,
93+ kind : "scalar" ,
94+ name : "String"
95+ }
96+ } ,
97+ ] ,
98+ resultType : {
99+ type : "named" ,
100+ kind : "scalar" ,
101+ name : "String"
102+ }
103+ }
104+ } ,
105+ objectTypes : { } ,
106+ scalarTypes : {
107+ "String" : { }
108+ }
109+ } ;
110+ const mutationRequest : sdk . MutationRequest = {
111+ operations : [
112+ {
113+ type : "procedure" ,
114+ name : "theFunction" ,
115+ fields : { } ,
116+ arguments : {
117+ "param" : "test"
118+ }
119+ } ,
120+ {
121+ type : "procedure" ,
122+ name : "theFunction" ,
123+ fields : { } ,
124+ arguments : {
125+ "param" : "test2"
126+ }
127+ }
128+ ] ,
129+ collection_relationships : { }
130+ } ;
131+
132+ await expect ( executeMutation ( mutationRequest , functionSchema , runtimeFunctions ) )
133+ . to . be . rejectedWith ( sdk . NotSupported , "Transactional mutations (multiple operations) are not supported" ) ;
134+ assert . equal ( functionCallCount , 0 ) ;
135+ } ) ;
136+
73137 describe ( "function error handling" , function ( ) {
74138 const functionSchema : FunctionsSchema = {
75139 functions : {
0 commit comments