File tree Expand file tree Collapse file tree 5 files changed +53
-2
lines changed Expand file tree Collapse file tree 5 files changed +53
-2
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ typings
Original file line number Diff line number Diff line change @@ -46,4 +46,7 @@ pg.query(query);
46
46
47
47
// or using lodash
48
48
pg .query (_ .assign (SQL ` SELECT author FROM books WHERE name = ${ book} ` , {name: ' my_query' }))
49
- ```
49
+ ```
50
+
51
+ # Contributing
52
+ - Tests are written using [ mocha] ( https://www.npmjs.com/package/mocha ) (BDD style) and [ chai] ( https://www.npmjs.com/package/chai ) (expect style)
Original file line number Diff line number Diff line change 21
21
" strings"
22
22
],
23
23
"author" : " Felix Becker" ,
24
- "license" : " ISC"
24
+ "license" : " ISC" ,
25
+ "devDependencies" : {
26
+ "chai" : " ^3.3.0"
27
+ }
25
28
}
Original file line number Diff line number Diff line change
1
+ /* global describe, it */
2
+ 'use strict'
3
+ let expect = require ( 'chai' ) . expect
4
+ let SQL = require ( '..' )
5
+
6
+ describe ( 'SQL' , function ( ) {
7
+ it ( 'should work with a simple query' , function ( ) {
8
+ expect ( SQL `SELECT * FROM table` ) . to . deep . equal ( {
9
+ sql : 'SELECT * FROM table' ,
10
+ text : 'SELECT * FROM table' ,
11
+ values : [ ]
12
+ } )
13
+ } )
14
+ it ( 'should work with a query with values' , function ( ) {
15
+ let value = 1234
16
+ expect ( SQL `SELECT * FROM table WHERE column = ${ value } ` ) . to . deep . equal ( {
17
+ sql : 'SELECT * FROM table WHERE column = ?' ,
18
+ text : 'SELECT * FROM table WHERE column = $1' ,
19
+ values : [ value ]
20
+ } )
21
+ } )
22
+ } )
Original file line number Diff line number Diff line change
1
+ {
2
+ "version" : " v4" ,
3
+ "repo" : " borisyankov/DefinitelyTyped" ,
4
+ "ref" : " master" ,
5
+ "path" : " typings" ,
6
+ "bundle" : " typings/tsd.d.ts" ,
7
+ "installed" : {
8
+ "assertion-error/assertion-error.d.ts" : {
9
+ "commit" : " d0adccc436197cc7c3559322721e9df86b892bd6"
10
+ },
11
+ "mocha/mocha.d.ts" : {
12
+ "commit" : " d0adccc436197cc7c3559322721e9df86b892bd6"
13
+ },
14
+ "chai/chai.d.ts" : {
15
+ "commit" : " d0adccc436197cc7c3559322721e9df86b892bd6"
16
+ },
17
+ "node/node.d.ts" : {
18
+ "commit" : " d0adccc436197cc7c3559322721e9df86b892bd6"
19
+ }
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments