-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: add simple integration tests #937
Conversation
a760276
to
b05833e
Compare
b05833e
to
3432f3d
Compare
Failing in CI due to:
... it looks like the DB is not initialised correctly. Perhaps the tests need to run in one of the wrappers from |
I think normally, tasks are tested using |
}); | ||
|
||
describe('command: user-create', () => { | ||
it('should return status code 0 and user details on success', () => { |
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.
It feels unclear to me what should be tested in this file vs. test/integration/task/account.js. It makes sense that this file is testing status codes. For testing output, my instinct is that that should be done in test/integration/task/account.js along with the other tests related to the behavior of each task.
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 is an integration test for lib/bin/cli.js
. I'd be surprised to find it in test/integration/task/account.js
. Perhaps cli.js
is named misleading though, as it only deals with accounts(?)
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 think that's right that cli.js only deals with accounts. It may have been named the way it was with the thought that it would eventually do more things. In the user docs, we mention an odk-cmd
, which just calls cli.js I think. As far as I know, the only other script that users run directly is restore.js for restoring a backup (user docs).
Good spot 😬 I think using the |
I agree that the structure of the config files could probably be improved. I'd be a little hesitant to make a big change there though. Doing so would require us to update the I think the strategy up to this point has been to keep the files in lib/bin simple and put most logic in lib/task. Logic in lib/task can be tested using |
And would require all deployments to change their config structure. We could still change the |
Ah I see. I think it's definitely worth considering that pattern. I'll defer to @ktuite and/or @sadiqkhoja about that change, but I can see how that pattern would solve the specific problem here and how it might be an improvement overall. |
I wrote these tests for confidence before merging #892.