Comparing version 2.0.0 to 2.1.0
@@ -290,2 +290,17 @@ // Load Modules | ||
internals.Table.prototype.sync = function (callback) { | ||
var self = this; | ||
this._table.sync().run(this._db._connection, function (err, result) { | ||
if (err) { | ||
return self.error('sync', err, null, callback); | ||
} | ||
return callback(); | ||
}); | ||
}; | ||
internals.Cursor = function (cursor) { | ||
@@ -292,0 +307,0 @@ |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur", |
@@ -955,2 +955,38 @@ // Load modules | ||
}); | ||
describe('sync()', function () { | ||
it('returns when write is complete', function (done) { | ||
var db = new Penseur.Db('penseurtest'); | ||
db.establish(['test'], function (err) { | ||
expect(err).to.not.exist(); | ||
db.test.insert([{ id: 1, a: 1 }, { id: 2, a: 2 }, { id: 3, a: 1 }], function (err, keys) { | ||
expect(err).to.not.exist(); | ||
db.test.sync(function (err) { | ||
expect(err).to.not.exist(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
it('fails on database error', function (done) { | ||
var db = new Penseur.Db('penseurtest'); | ||
db.table('invalid'); | ||
db.connect(function (err) { | ||
db.invalid.sync(function (err) { | ||
expect(err).to.exist(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53166
1212