fix test 3

This commit is contained in:
Manuel Araoz 2014-08-19 12:51:55 -04:00
commit f5e7886a72

View file

@ -512,7 +512,7 @@ describe('Wallet model', function() {
var stub = sinon.stub(w.publicKeyRing, 'copayersForPubkeys').returns({ var stub = sinon.stub(w.publicKeyRing, 'copayersForPubkeys').returns({
'027445ab3a935dce7aee1dadb0d103ed6147a0f83deb80474a04538b2c5bc4d509': 'pepe' '027445ab3a935dce7aee1dadb0d103ed6147a0f83deb80474a04538b2c5bc4d509': 'pepe'
}); });
w._handleTxProposal('senderID', txp, true); w._onTxProposal('senderID', txp, true);
Object.keys(w.txProposals.txps).length.should.equal(1); Object.keys(w.txProposals.txps).length.should.equal(1);
w.getTxProposals().length.should.equal(1); w.getTxProposals().length.should.equal(1);
//stub.restore(); //stub.restore();
@ -525,7 +525,7 @@ describe('Wallet model', function() {
id.should.equal(newId); id.should.equal(newId);
done(); done();
}); });
w._handleConnect(newId); w._onConnect(newId);
}); });
it('handle disconnections', function(done) { it('handle disconnections', function(done) {
@ -534,7 +534,7 @@ describe('Wallet model', function() {
id.should.equal(newId); id.should.equal(newId);
done(); done();
}); });
w._handleDisconnect(newId); w._onDisconnect(newId);
}); });
it('should register new copayers correctly', function() { it('should register new copayers correctly', function() {
@ -993,7 +993,7 @@ describe('Wallet model', function() {
var senderId = "03baa45498fee1045fa8f91a2913f638dc3979b455498924d3cf1a11303c679cdb"; var senderId = "03baa45498fee1045fa8f91a2913f638dc3979b455498924d3cf1a11303c679cdb";
Object.keys(w.addressBook).length.should.equal(2); Object.keys(w.addressBook).length.should.equal(2);
w._handleAddressBook(senderId, data, true); w._onAddressBook(senderId, data, true);
Object.keys(w.addressBook).length.should.equal(3); Object.keys(w.addressBook).length.should.equal(3);
}); });
@ -1252,7 +1252,7 @@ describe('Wallet model', function() {
describe('_handleTxProposal', function() { describe('_onTxProposal', function() {
var testValidate = function(response, result, done) { var testValidate = function(response, result, done) {
var w = cachedCreateW(); var w = cachedCreateW();
@ -1278,7 +1278,7 @@ describe('Wallet model', function() {
}; };
}); });
w._handleTxProposal('senderID', txp); w._onTxProposal('senderID', txp);
spy.callCount.should.equal(1); spy.callCount.should.equal(1);
merge.restore(); merge.restore();
}; };
@ -1299,11 +1299,11 @@ describe('Wallet model', function() {
}); });
describe('_handleReject', function() { describe('_onReject', function() {
it('should fails if unknown tx', function() { it('should fails if unknown tx', function() {
var w = cachedCreateW(); var w = cachedCreateW();
(function() { (function() {
w._handleReject(1, { w._onReject(1, {
ntxid: 1 ntxid: 1
}, 1); }, 1);
}).should.throw('Unknown TXP'); }).should.throw('Unknown TXP');
@ -1316,7 +1316,7 @@ describe('Wallet model', function() {
} }
}; };
(function() { (function() {
w._handleReject('john', { w._onReject('john', {
ntxid: 'qwerty' ntxid: 'qwerty'
}, 1); }, 1);
}).should.throw('already signed'); }).should.throw('already signed');
@ -1337,7 +1337,7 @@ describe('Wallet model', function() {
var spy2 = sinon.spy(w, 'emit'); var spy2 = sinon.spy(w, 'emit');
w.txProposals.txps['qwerty'] = new txp(); w.txProposals.txps['qwerty'] = new txp();
w.txProposals.txps['qwerty'].ok.should.equal(0); w.txProposals.txps['qwerty'].ok.should.equal(0);
w._handleReject('john', { w._onReject('john', {
ntxid: 'qwerty' ntxid: 'qwerty'
}, 1); }, 1);
w.txProposals.txps['qwerty'].ok.should.equal(1); w.txProposals.txps['qwerty'].ok.should.equal(1);
@ -1353,11 +1353,11 @@ describe('Wallet model', function() {
}); });
describe('_handleSeen', function() { describe('_onSeen', function() {
it('should fails if unknown tx', function() { it('should fails if unknown tx', function() {
var w = cachedCreateW(); var w = cachedCreateW();
(function() { (function() {
w._handleReject(1, { w._onReject(1, {
ntxid: 1 ntxid: 1
}, 1); }, 1);
}).should.throw('Unknown TXP'); }).should.throw('Unknown TXP');
@ -1378,7 +1378,7 @@ describe('Wallet model', function() {
var spy2 = sinon.spy(w, 'emit'); var spy2 = sinon.spy(w, 'emit');
w.txProposals.txps['qwerty'] = new txp(); w.txProposals.txps['qwerty'] = new txp();
w.txProposals.txps['qwerty'].ok.should.equal(0); w.txProposals.txps['qwerty'].ok.should.equal(0);
w._handleSeen('john', { w._onSeen('john', {
ntxid: 'qwerty' ntxid: 'qwerty'
}, 1); }, 1);
w.txProposals.txps['qwerty'].ok.should.equal(1); w.txProposals.txps['qwerty'].ok.should.equal(1);