File tree Expand file tree Collapse file tree 1 file changed +30
-6
lines changed Expand file tree Collapse file tree 1 file changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -33,30 +33,54 @@ describe('Queryable ::', function() {
33
33
34
34
// Store the connection
35
35
connection = report . connection ;
36
- return done ( ) ;
36
+
37
+ // Create a table to use for testing
38
+ // Uses sendNativeQuery but doesn't get rows or anything.
39
+ // TODO: figure out a query that can run with the given permissions
40
+ // that doesn't need an additional table
41
+ Pack . sendNativeQuery ( {
42
+ connection : connection ,
43
+ nativeQuery : 'CREATE TABLE IF NOT EXISTS people(name varchar(255));'
44
+ } )
45
+ . exec ( function ( err ) {
46
+ if ( err ) {
47
+ return done ( err ) ;
48
+ }
49
+
50
+ return done ( ) ;
51
+ } ) ;
37
52
} ) ;
38
53
} ) ;
39
54
} ) ;
40
55
41
56
// Afterwards release the connection
42
57
after ( function ( done ) {
43
- Pack . releaseConnection ( {
44
- connection : connection
45
- } ) . exec ( done ) ;
58
+ Pack . sendNativeQuery ( {
59
+ connection : connection ,
60
+ nativeQuery : 'DROP TABLE people;'
61
+ } )
62
+ . exec ( function ( err ) {
63
+ if ( err ) {
64
+ return done ( err ) ;
65
+ }
66
+
67
+ Pack . releaseConnection ( {
68
+ connection : connection
69
+ } ) . exec ( done ) ;
70
+ } ) ;
46
71
} ) ;
47
72
48
73
it ( 'should run a native query and return the reports' , function ( done ) {
49
74
Pack . sendNativeQuery ( {
50
75
connection : connection ,
51
- nativeQuery : 'SHOW GRANTS FOR \'mp\' ;'
76
+ nativeQuery : 'select * from people ;'
52
77
} )
53
78
. exec ( function ( err , report ) {
54
79
if ( err ) {
55
80
return done ( err ) ;
56
81
}
57
82
58
83
assert ( _ . isArray ( report . result . rows ) ) ;
59
- assert ( report . result . rows . length ) ;
60
84
61
85
return done ( ) ;
62
86
} ) ;
You can’t perform that action at this time.
0 commit comments