@@ -37,11 +37,10 @@ describe('ToolboxClient E2E Tests', () => {
37
37
describe ( 'invokeTool' , ( ) => {
38
38
it ( 'should invoke the getNRowsTool' , async ( ) => {
39
39
const response = await getNRowsTool ( { num_rows : '2' } ) ;
40
- const result = response [ 'result' ] ;
41
- expect ( typeof result ) . toBe ( 'string' ) ;
42
- expect ( result ) . toContain ( 'row1' ) ;
43
- expect ( result ) . toContain ( 'row2' ) ;
44
- expect ( result ) . not . toContain ( 'row3' ) ;
40
+ expect ( typeof response ) . toBe ( 'string' ) ;
41
+ expect ( response ) . toContain ( 'row1' ) ;
42
+ expect ( response ) . toContain ( 'row2' ) ;
43
+ expect ( response ) . not . toContain ( 'row3' ) ;
45
44
} ) ;
46
45
47
46
it ( 'should invoke the getNRowsTool with missing params' , async ( ) => {
@@ -136,29 +135,26 @@ describe('ToolboxClient E2E Tests', () => {
136
135
it ( 'should successfully bind a parameter with bindParam and invoke' , async ( ) => {
137
136
const newTool = getNRowsTool . bindParam ( 'num_rows' , '3' ) ;
138
137
const response = await newTool ( ) ; // Invoke with no args
139
- const result = response [ 'result' ] ;
140
- expect ( result ) . toContain ( 'row1' ) ;
141
- expect ( result ) . toContain ( 'row2' ) ;
142
- expect ( result ) . toContain ( 'row3' ) ;
143
- expect ( result ) . not . toContain ( 'row4' ) ;
138
+ expect ( response ) . toContain ( 'row1' ) ;
139
+ expect ( response ) . toContain ( 'row2' ) ;
140
+ expect ( response ) . toContain ( 'row3' ) ;
141
+ expect ( response ) . not . toContain ( 'row4' ) ;
144
142
} ) ;
145
143
146
144
it ( 'should successfully bind parameters with bindParams and invoke' , async ( ) => {
147
145
const newTool = getNRowsTool . bindParams ( { num_rows : '3' } ) ;
148
146
const response = await newTool ( ) ; // Invoke with no args
149
- const result = response [ 'result' ] ;
150
- expect ( result ) . toContain ( 'row1' ) ;
151
- expect ( result ) . toContain ( 'row2' ) ;
152
- expect ( result ) . toContain ( 'row3' ) ;
153
- expect ( result ) . not . toContain ( 'row4' ) ;
147
+ expect ( response ) . toContain ( 'row1' ) ;
148
+ expect ( response ) . toContain ( 'row2' ) ;
149
+ expect ( response ) . toContain ( 'row3' ) ;
150
+ expect ( response ) . not . toContain ( 'row4' ) ;
154
151
} ) ;
155
152
156
153
it ( 'should successfully bind a synchronous function value' , async ( ) => {
157
154
const newTool = getNRowsTool . bindParams ( { num_rows : ( ) => '1' } ) ;
158
155
const response = await newTool ( ) ;
159
- const result = response [ 'result' ] ;
160
- expect ( result ) . toContain ( 'row1' ) ;
161
- expect ( result ) . not . toContain ( 'row2' ) ;
156
+ expect ( response ) . toContain ( 'row1' ) ;
157
+ expect ( response ) . not . toContain ( 'row2' ) ;
162
158
} ) ;
163
159
164
160
it ( 'should successfully bind an asynchronous function value' , async ( ) => {
@@ -169,23 +165,19 @@ describe('ToolboxClient E2E Tests', () => {
169
165
170
166
const newTool = getNRowsTool . bindParams ( { num_rows : asyncNumProvider } ) ;
171
167
const response = await newTool ( ) ;
172
- const result = response [ 'result' ] ;
173
-
174
- expect ( result ) . toContain ( 'row1' ) ;
175
-
176
- expect ( result ) . not . toContain ( 'row2' ) ;
168
+ expect ( response ) . toContain ( 'row1' ) ;
169
+ expect ( response ) . not . toContain ( 'row2' ) ;
177
170
} ) ;
178
171
179
172
it ( 'should successfully bind parameters at load time' , async ( ) => {
180
173
const tool = await commonToolboxClient . loadTool ( 'get-n-rows' , null , {
181
174
num_rows : '3' ,
182
175
} ) ;
183
176
const response = await tool ( ) ;
184
- const result = response [ 'result' ] ;
185
- expect ( result ) . toContain ( 'row1' ) ;
186
- expect ( result ) . toContain ( 'row2' ) ;
187
- expect ( result ) . toContain ( 'row3' ) ;
188
- expect ( result ) . not . toContain ( 'row4' ) ;
177
+ expect ( response ) . toContain ( 'row1' ) ;
178
+ expect ( response ) . toContain ( 'row2' ) ;
179
+ expect ( response ) . toContain ( 'row3' ) ;
180
+ expect ( response ) . not . toContain ( 'row4' ) ;
189
181
} ) ;
190
182
191
183
it ( 'should throw an error when re-binding an existing parameter' , ( ) => {
@@ -268,7 +260,7 @@ describe('ToolboxClient E2E Tests', () => {
268
260
'my-test-auth' : authToken1Getter ,
269
261
} ) ;
270
262
const response = await authTool ( { id : '2' } ) ;
271
- expect ( response . result ) . toContain ( 'row2' ) ;
263
+ expect ( response ) . toContain ( 'row2' ) ;
272
264
} ) ;
273
265
274
266
it ( 'should succeed when running a tool with correct async auth' , async ( ) => {
@@ -280,7 +272,7 @@ describe('ToolboxClient E2E Tests', () => {
280
272
'my-test-auth' : getAsyncToken ,
281
273
} ) ;
282
274
const response = await authTool ( { id : '2' } ) ;
283
- expect ( response . result ) . toContain ( 'row2' ) ;
275
+ expect ( response ) . toContain ( 'row2' ) ;
284
276
} ) ;
285
277
286
278
it ( 'should fail when a tool with a param requiring auth is run without auth' , async ( ) => {
@@ -295,9 +287,9 @@ describe('ToolboxClient E2E Tests', () => {
295
287
'my-test-auth' : authToken1Getter ,
296
288
} ) ;
297
289
const response = await tool ( ) ;
298
- expect ( response . result ) . toContain ( 'row4' ) ;
299
- expect ( response . result ) . toContain ( 'row5' ) ;
300
- expect ( response . result ) . toContain ( 'row6' ) ;
290
+ expect ( response ) . toContain ( 'row4' ) ;
291
+ expect ( response ) . toContain ( 'row5' ) ;
292
+ expect ( response ) . toContain ( 'row6' ) ;
301
293
} ) ;
302
294
303
295
it ( 'should fail when a tool with a param requiring auth is run with insufficient auth claims' , async ( ) => {
0 commit comments