intkeygenerator
Version:
int secuential primarykey generator for SQL Server
41 lines (37 loc) • 1.22 kB
JavaScript
var chai = require('chai')
, expect = chai.expect
, should = chai.should();
var keyGeneratorSql = require('../keyGeneratorSqlServer');
debugger;
keyGeneratorSql.setConfig( {user: 'test', password: 'test', server: 'localhost', database: 'test' });
var keyGenerator = keyGeneratorSql.getKeyGenerator();
describe('keyGeneratorMsSql', function(){
it('next debe retornar numeros secuenciales', function(done){
keyGenerator.getBlock(2, function(err, value) {
keyGenerator.next(function(err, value){
expect(err).to.not.exist;
var next = value;
console.log('next: ' + value);
keyGenerator.next(function(err, value){
expect(err).to.not.exist;
value.should.be.equal(next + 1);
next = value;
console.log('next: ' + value);
keyGenerator.next(function(err, value){
expect(err).to.not.exist;
value.should.be.equal(next + 1);
next = value;
console.log('next: ' + value);
keyGenerator.next(function(err, value){
expect(err).to.not.exist;
value.should.be.equal(next + 1);
next = value;
console.log('next: ' + value);
done();
});
});
});
});
});
});
});