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

Unit tests for Multisignatures module - Closes #1723 #2326

Merged
merged 7 commits into from
Aug 28, 2018

Conversation

yatki
Copy link
Contributor

@yatki yatki commented Aug 21, 2018

Review checklist

@yatki yatki self-assigned this Aug 21, 2018
@yatki yatki changed the base branch from development to 1.2.0 August 21, 2018 12:53
@yatki yatki changed the base branch from 1.2.0 to development August 21, 2018 13:06
@yatki yatki changed the base branch from development to 1.2.0 August 21, 2018 13:10
@diego-G diego-G modified the milestone: Version 1.2.0 Aug 21, 2018
@diego-G diego-G requested a review from SargeKhan August 21, 2018 13:28
@MaciejBaj MaciejBaj requested a review from 4miners August 21, 2018 14:27
Copy link
Contributor

@4miners 4miners left a comment

Choose a reason for hiding this comment

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

@yatki Why this PR solves #1723 partially? Are unit tests for multisignatures module are complete now?

@yatki yatki changed the title Unit tests for Multisignatures module - Partially Closes #1723 Unit tests for Multisignatures module - Closes #1723 Aug 22, 2018
@yatki
Copy link
Contributor Author

yatki commented Aug 22, 2018

@4miners the initial skeleton for unit tests was huge, so idea was to separate them into several PRs. But it's not needed anymore. I updated the PR.

@diego-G diego-G requested a review from 4miners August 23, 2018 11:33

const rewiredMultisignatures = rewire('../../../modules/multisignatures.js');

const validAccount = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use fixtures for that, you already importing those (accountsFixtures).

@@ -99,6 +138,7 @@ describe('multisignatures', () => {
// Create instance of multisignatures module
multisignaturesInstance = new rewiredMultisignatures(
(err, __multisignatures) => {
error = err;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not really needed to use global variable here, you can call done(err) instead.

.calledOnce;
});

it('assign __private.assetTypes[transactionTypes.MULTI]', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should assign

done();
});

it('should accept address as parameter', done => {
Copy link
Contributor

Choose a reason for hiding this comment

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

description doesn't match what is tested, please clarify

});
});

it('should fail if getMultiSignature function returns an error', done => {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not failing, it's calling callback with error

});
});

it('should fail if given address does not return an account', done => {
Copy link
Contributor

Choose a reason for hiding this comment

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

wrong description, you're not testing the behavior of getMultiSignature, so you cannot be sure of the reason why this function returning empty account

expect(get('modules').accounts.getAccounts).to.be.calledWith({
address: ['address1'],
});
expect(scopeGroup.members)
Copy link
Contributor

Choose a reason for hiding this comment

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

please also test with more than 1 member

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored this test to have multiple members instead of adding another one.

done();
});

it('should fail library.logic.account.get function returns an error', done => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should call a callback with ApiError instance when...

@MaciejBaj MaciejBaj merged commit ef6e7e2 into 1.2.0 Aug 28, 2018
@MaciejBaj MaciejBaj deleted the 1723-unit-tests-for-multisigatures branch August 28, 2018 16:01
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.

5 participants