water-orm
Version:
A monolith version of Standalone waterline ORM
51 lines (39 loc) • 1.32 kB
JavaScript
var Adapter = require('../../../../lib/adapters/worm-postgresql/adapter.js'),
Config = require('./support/config'),
Fixture = require('./support/fixture'),
assert = require('assert'),
async = require('async');
var CONNECTIONS = 10000;
describe('Load Testing', function() {
this.timeout(60000);
before(function(done) {
var Schema;
// Register The Collection
Adapter.registerCollection({ identity: 'loadTest', config: Config }, function(err) {
if(err) done(err);
// Define The Collection
Adapter.define('loadTest', Fixture, function(err, schema) {
if(err) return done(err);
Schema = schema;
done();
});
});
});
describe('create with x connection', function() {
it('should not error', function(done) {
// generate x users
async.times(CONNECTIONS, function(n, next){
var data = {
first_name: Math.floor((Math.random()*100000)+1),
last_name: Math.floor((Math.random()*100000)+1),
email: Math.floor((Math.random()*100000)+1)
};
Adapter.create('loadTest', data, next);
}, function(err, users) {
assert(!err);
assert(users.length === CONNECTIONS);
done();
});
});
});
});