return txnote after edit

This commit is contained in:
Ivan Socolsky 2016-09-22 10:11:37 -03:00
parent 7f928b0afe
commit c4b293ed3a
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
2 changed files with 11 additions and 6 deletions

View File

@ -2068,7 +2068,10 @@ WalletService.prototype.editTxNote = function(opts, cb) {
} else {
note.edit(opts.body, self.copayerId);
}
self.storage.storeTxNote(note, cb);
self.storage.storeTxNote(note, function(err) {
if (err) return cb(err);
self.storage.fetchTxNote(self.walletId, opts.txid, cb);
});
});
});
};

View File

@ -3761,19 +3761,21 @@ describe('Wallet service', function() {
server.editTxNote({
txid: '123',
body: 'note body'
}, function(err) {
}, function(err, note) {
should.not.exist(err);
note.txid.should.equal('123');
note.walletId.should.equal(wallet.id);
note.body.should.equal('note body');
note.editedBy.should.equal(server.copayerId);
note.editedByName.should.equal('copayer 1');
note.createdOn.should.equal(note.editedOn);
server.getTxNote({
txid: '123',
}, function(err, note) {
should.not.exist(err);
should.exist(note);
note.txid.should.equal('123');
note.walletId.should.equal(wallet.id);
note.body.should.equal('note body');
note.editedBy.should.equal(server.copayerId);
note.editedByName.should.equal('copayer 1');
note.createdOn.should.equal(note.editedOn);
done();
});
});