Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Functional tx test type 2 - Closes #830 #839

Merged
merged 9 commits into from
Oct 14, 2017
Merged

Conversation

diego-G
Copy link

@diego-G diego-G commented Oct 10, 2017

Closes #830

@diego-G diego-G force-pushed the 830-functional_test_type_2 branch from 3307bdf to 92559a7 Compare October 11, 2017 11:21
getAccounts: getAccounts,
getAccountsPromise: getAccountsPromise,
getPublicKey: getPublicKey,
getBalancePromise: getBalancePromise,
getBalance: getBalance,
getPublicKeyPromise: getPublicKeyPromise
};
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

getJsonForKeyPromise = node.Promise.promisify(cache.getJsonForKey);
node.expect(err).to.not.exist;
node.expect(__cache).to.be.an('object');
return done(err, __cache);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why return __cache here?

cache.flushDb(function (err, status) {
node.expect(err).to.not.exist;
node.expect(status).to.equal('OK');
done(err, status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why return status?

it('using orderBy == "unknown:asc" should fail', function (done) {
var orderBy = 'unknown:asc';
var params = 'orderBy=' + orderBy;
it('using orderBy == "unknown:asc" should fail', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ==? globally

for (var i = 0; i < res.body.delegates.length; i++) {
if (res.body.delegates[i + 1] != null) {
node.expect(res.body.delegates[i].rank).to.be.at.above(res.body.delegates[i + 1].rank);
it('using orderBy == "rank:desc" should be ok', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, maybe change structure to something like:

describe('using orderBy'...
    it('rank:desc should be ok'...


http.get('/api/delegates/forging/ge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

@@ -32,8 +32,8 @@ describe('GET /api/transactions', function () {
before(function () {

var promises = [];
promises.push(creditAccountPromise(account.address, 100*100000000));
promises.push(creditAccountPromise(account2.address, 20*100000000));
promises.push(creditAccountPromise(account.address, 100 * 100000000));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use node.normalizer (name is not the best one) or maybe something from constants for calculations

@@ -321,7 +318,7 @@ describe('GET /api/transactions', function () {
});

it('using no params should be ok', function () {
return getTransactionsPromise([]).then(function (res) {
return getTransactionsPromise(null).then(function (res) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intended?

node.expect(res).to.have.property('success').to.be.ok;
node.expect(res).to.have.property('transactions').that.is.an('array');

var dividedIndices = res.transactions.reduce(function (memo, peer, index) {
memo[peer[sortField] === null ? 'nullIndices' : 'notNullIndices'].push(index);
return memo;
}, {notNullIndices: [], nullIndices: []});
}, { notNullIndices: [], nullIndices: [] });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why spaces here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eslint does not complain, my editor suggested me.

@@ -266,13 +266,13 @@ node.expectedFeeForTrsWithData = function (amount) {

// Returns a random username of 16 characters
node.randomUsername = function () {
var randomLetter = randomString.generate({
var randomLetter = node.randomString.generate({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why first char need to be alphabetic lowercase?

Copy link
Author

@diego-G diego-G Oct 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a choice. How would you make it?

@diego-G diego-G force-pushed the 830-functional_test_type_2 branch from d9990ae to ae798db Compare October 11, 2017 14:55
SargeKhan
SargeKhan previously approved these changes Oct 11, 2017
node.expect(err).to.not.exist;
node.expect(res).to.eql(response);
done(err, res);
return getDelegatesPromise(null).then(function (res) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to pass null

@diego-G diego-G force-pushed the 830-functional_test_type_2 branch 2 times, most recently from 949164f to 1b4500c Compare October 12, 2017 10:43
@diego-G diego-G force-pushed the 830-functional_test_type_2 branch from 1b4500c to 1671f5d Compare October 12, 2017 10:59
@diego-G diego-G requested a review from SargeKhan October 12, 2017 13:00
@diego-G diego-G requested a review from MaciejBaj October 12, 2017 14:37
4miners
4miners previously approved these changes Oct 13, 2017
MaciejBaj
MaciejBaj previously approved these changes Oct 13, 2017
@@ -5,6 +5,15 @@ var lisk = require('lisk-js');
var node = require('../node');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment - please don't consider it as a requested changes but a thing to keep in mind for the future - the file is already big and it is pretty hard to find the functions.
Maybe it is better to organize it in a json structure like:

transactions: {
   get: function () ....
   getUnconfirmed: function () ....
} 

delegates: {
    register: function () {....

}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It is time to think out a better way. I am prioritising the inclusion of the tests first to see the final picture.

Isabello
Isabello previously approved these changes Oct 13, 2017

http.get('/api/delegates/forging/getForgedByAccount?' + buildParams(), function (err, res) {
node.expect(res.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test description says no end, and the test has end property.

@diego-G diego-G dismissed stale reviews from Isabello, MaciejBaj, and 4miners via 61d953c October 13, 2017 14:20
@diego-G diego-G requested review from SargeKhan, MaciejBaj and Isabello and removed request for LucasIsasmendi October 13, 2017 14:22
SargeKhan
SargeKhan previously approved these changes Oct 13, 2017
Isabello
Isabello previously approved these changes Oct 13, 2017
MaciejBaj
MaciejBaj previously approved these changes Oct 13, 2017
@Isabello Isabello dismissed stale reviews from MaciejBaj, SargeKhan, and themself via 2e90679 October 13, 2017 16:05
@Isabello Isabello merged commit 5c8709d into 1.0.0 Oct 14, 2017
@diego-G diego-G deleted the 830-functional_test_type_2 branch October 16, 2017 07:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants