Preserve sent timestamp for incoming proposals

This commit is contained in:
Ivan Socolsky 2014-10-06 18:51:45 -03:00
commit 9d5b26f526
3 changed files with 42 additions and 4 deletions

View file

@ -1564,6 +1564,7 @@ describe('Wallet model', function() {
var txp = {
getSeen: sinon.stub().returns(true),
setCopayers: sinon.stub().returns(['new copayer']),
getSent: sinon.stub().returns(false),
setSent: sinon.spy(),
builder: {
build: sinon.stub().returns({
@ -1595,6 +1596,7 @@ describe('Wallet model', function() {
var txp = {
getSeen: sinon.stub().returns(true),
setCopayers: sinon.stub().returns(['new copayer']),
getSent: sinon.stub().returns(false),
setSent: sinon.spy(),
builder: {
build: sinon.stub().returns({
@ -1618,6 +1620,38 @@ describe('Wallet model', function() {
done();
});
it('should not overwrite sent info', function(done) {
var data = {
txProposal: {
dummy: 1,
},
};
var txp = {
getSeen: sinon.stub().returns(true),
setCopayers: sinon.stub().returns(['new copayer']),
getSent: sinon.stub().returns(true),
setSent: sinon.spy(),
builder: {
build: sinon.stub().returns({
isComplete: sinon.stub().returns(true),
}),
},
};
w.txProposals.merge = sinon.stub().returns({
ntxid: 1,
txp: txp,
new: false,
hasChanged: false,
});
w._checkSentTx = sinon.stub().yields(true);
w._onTxProposal('senderID', data);
txp.setSent.called.should.be.false;
w.sendTxProposal.called.should.be.false;
done();
});
it('should resend when not complete only if changed', function(done) {
var data = {
txProposal: {