forked from tjwebb/pg-json-data-export
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
37 lines (32 loc) · 1016 Bytes
/
test.js
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
35
36
37
var fs = require('fs');
var assert = require('assert');
var _ = require('lodash');
var exporter = require('./');
var util = require('util');
describe('pg-json-data-export', function () {
var options = {
user: process.env.POSTGRES_USER || 'postgres',
password: process.env.POSTGRES_PASSWORD || 'postgres',
database: process.env.POSTGRES_DATABASE || 'postgres',
port: process.env.POSTGRES_PORT || 5432
};
describe('#toJSON', function () {
this.timeout(300 * 1000); // 5 minutes
var db;
before(function (done) {
exporter.toJSON(options, 'public')
.then(function (_db) {
db = _db;
done();
}).catch(done);
});
it('should return an object', function () {
assert(_.isObject(db));
fs.writeFileSync('build/postbooks_demo_460_data.json', JSON.stringify(db, null, 2));
});
it('should contain lots of data', function () {
var str = JSON.stringify(db);
assert(str.length > 1048576); // 1mb
});
});
});