@@ -32,7 +32,7 @@ describe("mssql", () => {
32
32
33
33
describe ( "when querying" , ( ) => {
34
34
it ( "should stream the results of simple query" , ( ) => {
35
- return new Promise ( async ( resolve , reject ) => {
35
+ return new Promise ( ( resolve ) => {
36
36
const req = new MockReq ( { method : "POST" , url : "/query-stream" } ) . end ( {
37
37
sql : "SELECT TOP 2 CustomerID FROM test.SalesLT.Customer" ,
38
38
params : [ ] ,
@@ -41,7 +41,7 @@ describe("mssql", () => {
41
41
const res = new MockRes ( onEnd ) ;
42
42
43
43
const index = mssql ( credentials ) ;
44
- await index ( req , res ) ;
44
+ index ( req , res ) ;
45
45
46
46
function onEnd ( ) {
47
47
const [ schema , row ] = this . _getString ( ) . split ( "\n" ) ;
@@ -62,17 +62,18 @@ describe("mssql", () => {
62
62
} ) ;
63
63
} ) ;
64
64
it ( "should handle parameter graciously" , ( ) => {
65
- return new Promise ( async ( resolve , reject ) => {
65
+ return new Promise ( ( resolve ) => {
66
66
const testCustomerId = 3 ;
67
67
const req = new MockReq ( { method : "POST" , url : "/query-stream" } ) . end ( {
68
- sql : "SELECT TOP 2 CustomerID FROM test.SalesLT.Customer WHERE CustomerID=@1" ,
68
+ sql :
69
+ "SELECT TOP 2 CustomerID FROM test.SalesLT.Customer WHERE CustomerID=@1" ,
69
70
params : [ testCustomerId ] ,
70
71
} ) ;
71
72
72
73
const res = new MockRes ( onEnd ) ;
73
74
74
75
const index = mssql ( credentials ) ;
75
- await index ( req , res ) ;
76
+ index ( req , res ) ;
76
77
77
78
function onEnd ( ) {
78
79
const [ schema , row ] = this . _getString ( ) . split ( "\n" ) ;
@@ -93,17 +94,18 @@ describe("mssql", () => {
93
94
} ) ;
94
95
} ) ;
95
96
it ( "should replace cell reference in the SQL query" , ( ) => {
96
- return new Promise ( async ( resolve , reject ) => {
97
+ return new Promise ( ( resolve ) => {
97
98
const testCustomerId = 5 ;
98
99
const req = new MockReq ( { method : "POST" , url : "/query-stream" } ) . end ( {
99
- sql : "SELECT TOP 2 CustomerID FROM test.SalesLT.Customer WHERE CustomerID=@1" ,
100
+ sql :
101
+ "SELECT TOP 2 CustomerID FROM test.SalesLT.Customer WHERE CustomerID=@1" ,
100
102
params : [ testCustomerId ] ,
101
103
} ) ;
102
104
103
105
const res = new MockRes ( onEnd ) ;
104
106
105
107
const index = mssql ( credentials ) ;
106
- await index ( req , res ) ;
108
+ index ( req , res ) ;
107
109
108
110
function onEnd ( ) {
109
111
const [ schema , row ] = this . _getString ( ) . split ( "\n" ) ;
@@ -124,7 +126,7 @@ describe("mssql", () => {
124
126
} ) ;
125
127
} ) ;
126
128
it ( "should handle duplicated column names" , ( ) => {
127
- return new Promise ( async ( resolve , reject ) => {
129
+ return new Promise ( ( resolve ) => {
128
130
const req = new MockReq ( { method : "POST" , url : "/query-stream" } ) . end ( {
129
131
sql : "SELECT 1 as _a1, 2 as _a1 FROM test.SalesLT.SalesOrderDetail" ,
130
132
params : [ ] ,
@@ -133,10 +135,10 @@ describe("mssql", () => {
133
135
const res = new MockRes ( onEnd ) ;
134
136
135
137
const index = mssql ( credentials ) ;
136
- await index ( req , res ) ;
138
+ index ( req , res ) ;
137
139
138
140
function onEnd ( ) {
139
- const [ schema , row ] = this . _getString ( ) . split ( "\n" ) ;
141
+ const [ , row ] = this . _getString ( ) . split ( "\n" ) ;
140
142
141
143
expect ( row ) . to . equal (
142
144
JSON . stringify ( {
@@ -149,16 +151,17 @@ describe("mssql", () => {
149
151
} ) ;
150
152
} ) ;
151
153
it ( "should select the last value of any detected duplicated columns" , ( ) => {
152
- return new Promise ( async ( resolve , reject ) => {
154
+ return new Promise ( ( resolve ) => {
153
155
const req = new MockReq ( { method : "POST" , url : "/query-stream" } ) . end ( {
154
- sql : "SELECT TOP 1 ModifiedDate, ModifiedDate FROM test.SalesLT.SalesOrderDetail" ,
156
+ sql :
157
+ "SELECT TOP 1 ModifiedDate, ModifiedDate FROM test.SalesLT.SalesOrderDetail" ,
155
158
params : [ ] ,
156
159
} ) ;
157
160
158
161
const res = new MockRes ( onEnd ) ;
159
162
160
163
const index = mssql ( credentials ) ;
161
- await index ( req , res ) ;
164
+ index ( req , res ) ;
162
165
163
166
function onEnd ( ) {
164
167
const [ schema , row ] = this . _getString ( ) . split ( "\n" ) ;
0 commit comments