@@ -244,6 +244,76 @@ describe("WebPanels", () => {
244244 stub . restore ( ) ;
245245 } ) ;
246246
247+ it ( "should convert results to grid format for insights above 1.12" , ( ) => {
248+ const results : StructuredTextResults = {
249+ columns : [
250+ {
251+ name : "prop1" ,
252+ type : "type1" ,
253+ values : [ "value1" , "value2" ] ,
254+ order : [ 1 , 2 ] ,
255+ } ,
256+ {
257+ name : "prop2" ,
258+ type : "type2" ,
259+ values : [ "value3" , "value4" ] ,
260+ order : [ 1 , 2 ] ,
261+ } ,
262+ ] ,
263+ count : 2 ,
264+ } ;
265+
266+ const expectedOutput = JSON . stringify ( {
267+ defaultColDef : {
268+ sortable : true ,
269+ resizable : true ,
270+ filter : true ,
271+ flex : 1 ,
272+ minWidth : 100 ,
273+ } ,
274+ rowData : [
275+ { index : 1 , prop1 : "value2" , prop2 : "value4" } ,
276+ { index : 2 } ,
277+ ] ,
278+ columnDefs : [
279+ { field : "index" , headerName : "Index" , cellDataType : "number" } ,
280+ {
281+ field : "prop1" ,
282+ headerName : "prop1" ,
283+ cellDataType : "text" ,
284+ cellRendererParams : { disabled : false } ,
285+ headerTooltip : "type1" ,
286+ } ,
287+ {
288+ field : "prop2" ,
289+ headerName : "prop2" ,
290+ cellDataType : "text" ,
291+ cellRendererParams : { disabled : false } ,
292+ headerTooltip : "type2" ,
293+ } ,
294+ ] ,
295+ domLayout : "autoHeight" ,
296+ pagination : true ,
297+ paginationPageSize : 100 ,
298+ enableCellTextSelection : true ,
299+ ensureDomOrder : true ,
300+ suppressContextMenu : true ,
301+ suppressDragLeaveHidesColumns : true ,
302+ tooltipShowDelay : 200 ,
303+ loading : true ,
304+ } ) ;
305+
306+ // Mock ext.connectionNode
307+ const stub = sinon . stub ( ext , "activeConnection" ) ;
308+ stub . get ( ( ) => insightsConn ) ;
309+
310+ const output = resultsPanel . convertToGrid ( results , true , 1.12 ) ;
311+ assert . equal ( JSON . stringify ( output ) , expectedOutput ) ;
312+
313+ // Restore the stub
314+ stub . restore ( ) ;
315+ } ) ;
316+
247317 it ( "should convert results to grid format with empty rows" , ( ) => {
248318 const results = {
249319 data : {
0 commit comments