1
- var helper = require ( __dirname + '/test-helper' ) ;
2
1
/*
3
- test('check that passed values types have not been changed during the query phase', function() {
4
- var client = helper.client();
5
- client.connect(assert.success(function() {
6
- var originalValues = [1,new Date()];
7
- var values = originalValues.slice();
8
- var config = {
9
- text: 'SELECT 1 WHERE 0 <> $1 AND 0 <> $2',
10
- values: values
11
- };
12
- client.query(config, function(result) {
13
- assert.equal(result.rows.length, 1);
14
- console.log('result:',result.rows[0]);
15
- assert.equal(values.length,originalValues.length,'expecting same length as given array!');
16
- assert.strictEqual(isNaN(values[0]),false,'expecting a number!');
17
- assert.strictEqual(values[1] instanceof Date,true,'expecting a Date object!');
18
- client.end();
19
- });
20
- }));
21
- });
22
-
23
- test('check that passed values types have not been changed during the query phase', function() {
24
- var client = helper.client();
25
-
26
- var originalValues = [1,new Date()];
27
- var values = originalValues.slice();
28
- var config = {
29
- text: 'SELECT 1 WHERE 0 <> $1 AND 0 <> $2',
30
- values: values
31
- };
32
- client.query(config, function(result) {
33
- assert.equal(result.rows.length, 1);
34
- console.log('result:',result.rows[0]);
35
- assert.equal(values.length,originalValues.length,'expecting same length as given array!');
36
- assert.strictEqual(isNaN(values[0]),false,'expecting a number!');
37
- assert.strictEqual(values[1] instanceof Date,true,'expecting a Date object!');
38
- client.end();
39
- });
40
- });
41
- */
2
+ var helper = require(__dirname+'/test-helper');
42
3
var client = helper.client();
43
4
44
5
test('check that passed values types have not been changed during the query phase', assert.calls(function() {
@@ -53,4 +14,27 @@ test('check that passed values types have not been changed during the query phas
53
14
assert.strictEqual(isNaN(values[0]),false,'expecting a number!');
54
15
assert.strictEqual(values[1] instanceof Date,true,'expecting a Date object!');
55
16
})
56
- } ) ) ;
17
+ })); */
18
+
19
+ var helper = require ( __dirname + '/test-helper' ) ;
20
+ var pg = helper . pg ;
21
+ var config = helper . config ;
22
+
23
+ test ( 'check that passed values types have not been changed during the query phase' , function ( ) {
24
+
25
+ pg . connect ( config , assert . success ( function ( client , done ) {
26
+ var originalValues = [ 1 , new Date ( ) ] ;
27
+ var values = originalValues . slice ( ) ;
28
+
29
+ client . query ( 'SELECT 1 WHERE 0 <> $1 AND 0 <> $2' , values , assert . success ( function ( err , result ) {
30
+ assert . isNull ( err ) ;
31
+ assert . equal ( result . rows . length , 1 ) ;
32
+ console . log ( 'result:' , result . rows [ 0 ] ) ;
33
+ assert . equal ( values . length , originalValues . length , 'expecting same length as given array!' ) ;
34
+ assert . strictEqual ( isNaN ( values [ 0 ] ) , false , 'expecting a number!' ) ;
35
+ assert . strictEqual ( values [ 1 ] instanceof Date , true , 'expecting a Date object!' ) ;
36
+ done ( ) ;
37
+ } ) ) ;
38
+
39
+ } ) ) ;
40
+ } ) ;
0 commit comments