File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -68,5 +68,32 @@ describe("mssql", () => {
68
68
) ;
69
69
expect ( row ) . to . equal ( JSON . stringify ( { CustomerID : 12 } ) ) ;
70
70
} ) ;
71
+
72
+ it ( "should stream the results of simple query" , async ( ) => {
73
+ const req = new MockReq ( { method : "POST" , url : "/query-stream" } ) . end ( {
74
+ sql : "SELECT TOP 2 CustomerID FROM test.SalesLT.Customer" ,
75
+ params : [ ] ,
76
+ } ) ;
77
+
78
+ const res = new MockRes ( onEnd ) ;
79
+
80
+ const index = mssql ( credentials ) ;
81
+ await index ( req , res ) ;
82
+
83
+ function onEnd ( ) {
84
+ const [ schema , row ] = this . _getString ( ) . split ( "\n" ) ;
85
+
86
+ expect ( schema ) . to . equal (
87
+ JSON . stringify ( {
88
+ type : "array" ,
89
+ items : {
90
+ type : "object" ,
91
+ properties : { CustomerID : { type : [ "null" , "integer" ] } } ,
92
+ } ,
93
+ } )
94
+ ) ;
95
+ expect ( row ) . to . equal ( JSON . stringify ( { CustomerID : 12 } ) ) ;
96
+ }
97
+ } ) ;
71
98
} ) ;
72
99
} ) ;
You can’t perform that action at this time.
0 commit comments