Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ node_js:
- "9"
- "8"
- "6"
- "4"
script: "npm run jshint && npm run test-cover"
# Send coverage data to Coveralls
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
5 changes: 3 additions & 2 deletions lib/client/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,10 @@ Doc.prototype._hardRollback = function(err) {
};

Doc.prototype._clearInflightOp = function(err) {
var called = callEach(this.inflightOp.callbacks, err);

var callbacks = this.inflightOp && this.inflightOp.callbacks;
this.inflightOp = null;
var called = callbacks && callEach(callbacks, err);

this.flush();
this._emitNothingPending();

Expand Down
33 changes: 33 additions & 0 deletions test/client/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,39 @@ describe('client submit', function() {
});
});

it('hasWritePending is false when create\'s callback is executed', function(done) {
var doc = this.backend.connect().get('dogs', 'fido');
doc.create({age: 3}, function(err) {
if (err) return done(err);
expect(doc.hasWritePending()).equal(false);
done();
});
});

it('hasWritePending is false when submimtOp\'s callback is executed', function(done) {
var doc = this.backend.connect().get('dogs', 'fido');
doc.create({age: 3}, function(err) {
if (err) return done(err);
doc.submitOp({p: ['age'], na: 2}, function(err) {
if (err) return done(err);
expect(doc.hasWritePending()).equal(false);
done();
});
});
});

it('hasWritePending is false when del\'s callback is executed', function(done) {
var doc = this.backend.connect().get('dogs', 'fido');
doc.create({age: 3}, function(err) {
if (err) return done(err);
doc.del(function(err) {
if (err) return done(err);
expect(doc.hasWritePending()).equal(false);
done();
});
});
});

describe('type.deserialize', function() {
it('can create a new doc', function(done) {
var doc = this.backend.connect().get('dogs', 'fido');
Expand Down