-
Notifications
You must be signed in to change notification settings - Fork 457
Functional test tx type 3 - Subtask #678 - Close #835 #882
Conversation
test/functional/http/post/3.votes.js
Outdated
var accountMinimalFunds = node.randomAccount(); | ||
var accountDuplicate = node.randomAccount(); | ||
|
||
var account33 = node.randomAccount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it some better name for account33?
test/functional/http/post/3.votes.js
Outdated
}) | ||
.then(function (res) { | ||
var promisesCredits33 = []; | ||
for (var i = 0; i < 33; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to name the variables instead of using magic numbers.
var MAX_VOTES_IN_ONE_TRANSACTION = 33;
test/functional/http/post/3.votes.js
Outdated
var transaction; | ||
|
||
before(function () { | ||
// Crediting accounts and registering delegates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would appreciate a better description - why all the steps below are needed. The scenario descriptions.
test/functional/http/post/3.votes.js
Outdated
|
||
describe('transactions processing', function () { | ||
|
||
it('upvoting with manipulated vote should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with "++" preset
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('downvoting with manipulated vote should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with "--"
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('upvoting 33 delegates at once should be ok', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
33 (maximum amount)
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('upvoting 101 delegates separately should be ok', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is upvoting 102 delegates done in the different place?
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('upvoting 34 delegates at once should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
34 (1 extra)
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('self downvoting should be ok', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing self downvoting twice should fail?
goodTransactions.push(transaction); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is downvoting done in a different place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because It performs the downvoting over the same fresh accounts just voted in the prior phase.
- Better variable naming - Add comments - Improve descriptions - Get constants from core - Add new test for unconfirmed states - Review arrays of enforcement transactions
03befea
to
1e65dcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, few issues mentioned in comments, in addition to that:
- you are testing upvoting with '++', but not downvoting with '--'
- ss I mentioned the last time - would be really nice if above the before the section you will write the scenario of those tests as the process is complex
test/functional/http/post/3.votes.js
Outdated
|
||
describe('transactions processing', function () { | ||
|
||
it('voting with invalid vote format should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
voting with "++" operator should fail
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('voting with invalid vote length should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the test is about voting with invalid length - don't include the special "--" operator here
test/functional/http/post/3.votes.js
Outdated
}); | ||
}); | ||
|
||
it('using invalid vote operator \'x\' should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"x"
Thanks for insisting. Also it improves promises code format
test/functional/http/post/3.votes.js
Outdated
In this case, we create as many delegates as the network allows to be active. This parameter | ||
is directly related to the maximum number of allowed votes per account. Another independent | ||
account is credited and performs tests uniquely to delegates from this scenario. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typos:
Creating two scenarios with two isolated set of accounts
-
First scenario --> MaxVotesPerTransaction
We register the exact amount of delegates the networks allows to be voted per transaction.
A new fresh account is credited to perform the voting tests to those delegates. -
Second scenario --> MaxVotesPerAccount
In this case, we create as many delegates as the network allows to be active. This parameter
is directly related to the maximum number of allowed votes per account. Another independent
account is credited and performs tests uniquely to delegates from this scenario.
bfaa5eb
to
871aea9
Compare
871aea9
to
67e5541
Compare
test/functional/http/post/3.votes.js
Outdated
|
||
describe('unconfirmed state', function () { | ||
|
||
it('upvoting with valid params and duplicate submission should be ok but just first transaction to arrive will be confirmed', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test and its description are opposite,
67e5541
to
48844e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix these descriptions, please.
}); | ||
}); | ||
|
||
it('using invalid vote operator "x" should fail', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not use double quotes in descriptions? feels wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignored
test/functional/http/post/3.votes.js
Outdated
|
||
describe('unconfirmed state', function () { | ||
|
||
it('upvoting with valid params and duplicate submission should be ok but just last transaction to arrive will be confirmed', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this description needs some help.
test/functional/http/post/3.votes.js
Outdated
|
||
describe('unconfirmed state after validation', function () { | ||
|
||
it('downvoting with valid params and duplicate submission should be ok but just last transaction to arrive will be confirmed', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what?
Add transfer transaction class - Closes #882
Subtask #678
Close #835