Add tests for commands parsing and option handling
spalladino opened this issue · 8 comments
The entry point of the CLI is an instance of a commander program
. The different commands
(found in the folder with the same name) are each in a different file, where they register themselves to the program
, manipulate the options received from commander (if needed), and delegate the logic to the code in the scripts
folder (sometime combining more than one script
, such as add --push
).
Even though scripts
are thoroughly tested, we are not currently testing the code in the commands
folder. We need to add a suite of tests that use the commander program
to parse a string as if it were from the command line, and use test doubles to verify that the scripts
actually get the correct params.
Something along the lines of the following (note that the syntax is invented, and will depend on what kind of test doubles are used).
it('should call add with several contracts', function () {
program.parse('zos add foo bar')
expect(add).to.have.been.called.with(['foo', 'bar'])
});
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
This issue now has a funding of 180.0 DAI (180.0 USD @ $1.0/DAI) attached to it.
- If you would like to work on this issue you can 'start work' on the Gitcoin Issue Details page.
- Questions? Checkout Gitcoin Help or the Gitcoin Slack
- $30,665.12 more funded OSS Work available on the Gitcoin Issue Explorer
@on247 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!
- warning (3 days)
- escalation to mods (6 days)
Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
Work has been started.
These users each claimed they can complete the work by 6 months, 2 weeks ago.
Please review their action plans below:
1) bakaoh has started work.
I will use sinon to stub the commands' action
I will start work on this right away and have it ready by the end of the weekend.
Learn more on the Gitcoin Issue Details page.
@spalladino --- i've just created a wip pr with tests for add command, is it meet your expectations?
@bakaoh thanks a lot for the contribution! Let's move the discussion to the PR.
Fixed via #346. I'm not sure if I need to approve anything on @gitcoinbot to unlock the bounty, but it was great work by @bakaoh!
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
Work for 180.0 DAI (180.0 USD @ $1.0/DAI) has been submitted by:
@vs77bb please take a look at the submitted work:
- Learn more on the Gitcoin Issue Details page
- Want to chip in? Add your own contribution here.
- Questions? Checkout Gitcoin Help or the Gitcoin Slack
- $25,680.78 more funded OSS Work available on the Gitcoin Issue Explorer
Issue Status: 1. Open 2. Started 3. Submitted 4. Done
The funding of 180.0 DAI (180.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @bakaoh.
- Learn more on the Gitcoin Issue Details page
- Questions? Checkout Gitcoin Help or the Gitcoin Slack
- $23,937.86 more funded OSS Work available on the Gitcoin Issue Explorer