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

Add unit tests for signatures module - Closes #2445 #2682

Merged

Conversation

2snEM6
Copy link
Contributor

@2snEM6 2snEM6 commented Dec 20, 2018

What was the problem?

Unit tests for signatures module weren't implemented

How did I fix it?

Implemented unit tests for signatures module

How to test it?

npm run mocha -- test/unit/signatures

Review checklist

@2snEM6 2snEM6 self-assigned this Dec 20, 2018
@2snEM6
Copy link
Contributor Author

2snEM6 commented Jan 4, 2019

Perhaps I'm wrong but the postSignatures function on the signatures module is not being used anywhere and after discussing with @jondubois it was probably meant for some other case we don't use now. Also, inside the function implementation:

postSignatures(signatures, cb) {
  return modules.transport.shared.postSignatures(
    { signatures },
    (err, res) => {
	__private.processPostResult(err, res, cb);
    }
  );
}

the modules.transport.shared.postSignatures function definition isn't accepting a callback as an argument as expected by the unit tests, it's accepting just an argument called query.

The unit tests skeleton then isn't coherent with the current implementation.

What I did was instead, add unit testing coverage for the postSignature function which is indeed being used.

Also removed outdated unit tests skeletons.

@yatki
Copy link
Contributor

yatki commented Jan 7, 2019

@limiaspasdaniel you are right. There is a new relic definition for postSignatures tho but I think this is just for mapping purpose. @nazarhussain can you take a look and confirm.

You are also right on your comment regarding modules.transport.shared.postSignatures. I don't see any issue with updating test skeletons.

/* eslint-disable mocha/no-pending-tests */
/* eslint-disable no-unused-vars */
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it important to keep?

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 added it due to ESLint being picky when not using the last arguments on callback definitions. For example here and here. Also it wouldn't let me type "_" as the name of the arguments to dismiss those errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, please do not disable rules on file level. Disable the relevant lines instead with eslint-disable-next-line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

MaciejBaj
MaciejBaj previously approved these changes Jan 7, 2019
Copy link
Contributor

@yatki yatki left a comment

Choose a reason for hiding this comment

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

The test skeleton wasn't designed that good before. Please try to refactor it to have hooks and nested suites as less as possible.

/* eslint-disable mocha/no-pending-tests */
/* eslint-disable no-unused-vars */
Copy link
Contributor

Choose a reason for hiding this comment

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

If possible, please do not disable rules on file level. Disable the relevant lines instead with eslint-disable-next-line

@2snEM6 2snEM6 force-pushed the 2445-Add_unit_test_coverage_for_signatures_module branch from 00735eb to 355bb78 Compare January 8, 2019 09:14
@2snEM6
Copy link
Contributor Author

2snEM6 commented Jan 8, 2019

@yatki applied your suggested changes.

Copy link
Contributor

@yatki yatki left a comment

Choose a reason for hiding this comment

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

Looks very good. Just 2 minor comments.

@2snEM6 2snEM6 force-pushed the 2445-Add_unit_test_coverage_for_signatures_module branch from 355bb78 to 1669672 Compare January 8, 2019 10:51
@2snEM6
Copy link
Contributor Author

2snEM6 commented Jan 8, 2019

@yatki done, thanks :)

@2snEM6 2snEM6 force-pushed the 2445-Add_unit_test_coverage_for_signatures_module branch 2 times, most recently from 54b0b4f to 45c6688 Compare January 8, 2019 13:26
@2snEM6 2snEM6 force-pushed the 2445-Add_unit_test_coverage_for_signatures_module branch from 45c6688 to fc9ce23 Compare January 8, 2019 13:37
@MaciejBaj
Copy link
Contributor

Good job @limiaspasdaniel and @yatki on the review 👍

@MaciejBaj MaciejBaj merged commit 1f04d9a into development Jan 9, 2019
@MaciejBaj MaciejBaj deleted the 2445-Add_unit_test_coverage_for_signatures_module branch January 9, 2019 11:08
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.

Add unit test coverage for signatures module
3 participants