water-orm
Version:
A monolith version of Standalone waterline ORM
55 lines (41 loc) • 1.25 kB
JavaScript
var adapter = require('../../../../lib/adapters/worm-postgresql/adapter.js'),
should = require('should'),
support = require('./support/bootstrap');
describe('adapter', function() {
/**
* Setup and Teardown
*/
before(function(done) {
support.Setup('test_createEach', done);
});
after(function(done) {
support.Teardown('test_createEach', done);
});
// Attributes for the test table
var attributes = {
field_1: 'foo',
field_2: 'bar'
};
/**
* CREATE EACH
*
* Insert an array of rows into a table
*/
describe('.createEach()', function() {
// Insert multiple records
it('should insert multiple records', function(done) {
adapter.createEach('test', 'test_createEach', [attributes, attributes], function(err, result) {
// Check records were actually inserted
support.Client(function(err, client, close) {
client.query('SELECT * FROM "test_createEach"', function(err, result) {
// Test 2 rows are returned
result.rows.length.should.eql(2);
// close client
close();
done();
});
});
});
});
});
});