-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
34 lines (32 loc) · 1012 Bytes
/
test.js
File metadata and controls
34 lines (32 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Created by Administrator on 2015/6/16.
*/
var should = require('should');
var db = require('./biz/db_mssql');
var getArray = function(){
return [1,2,3];
};
var getString = function(){
return "H";
};
describe('Test Biz Functions', function(){
it('should return 1',function(done){
db.query('select * from [users] where name=\'admin\'',function(err, recordset){
(recordset.data).should.have.length(1);
done();
});
});
});
describe('Test Promise', function(){
it('should return 2',function(){
//getString().should.startWith('H');
return db.query('select * from [users] where name=\'test\'',function(err, recordset){
(recordset.data).should.have.length(1);
}).then(function(data){
var $ordersql = 'select * from [orders] where userid in(1)';
return db.query($ordersql,function(err, recordset){
recordset.data.should.have.length(4);
});
});
});
});