Skip to content
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

Add unit tests for javascript code #71

Open
hmshwt opened this issue Feb 2, 2018 · 4 comments
Open

Add unit tests for javascript code #71

hmshwt opened this issue Feb 2, 2018 · 4 comments

Comments

@hmshwt
Copy link
Contributor

hmshwt commented Feb 2, 2018

Issue:
There are no unit tests for JS code and running the current tests requires the developer to manually check if all notifications are displayed or not.

Proposed Solution:

  • Write unit tests for JS code with ( mocha, chai)
  • Use the library BATS for testing the shell commands generated by growl.
  • We can also borrow ideas from tests in node-notifier library

I would like to open a pull request for this issue. Please suggest another testing framework or any other libraries that you think will be a better alternative than the choices listed above.

@deiga
Copy link
Collaborator

deiga commented Feb 2, 2018

Mocha & Chai seem like a good, stable choice. If you want to make a PR about implementing the basic structures that would be lovely :)

@hmshwt
Copy link
Contributor Author

hmshwt commented Feb 11, 2018

Great! I was on vacation, I will open a PR by end of this week.

@hmshwt
Copy link
Contributor Author

hmshwt commented Feb 20, 2018

Hi @deiga
I am thinking of approaching in the following manner

  1. Extract https://github.com/tj/node-growl/blob/master/lib/growl.js#L304-L334 into a different function and make the function growl() return cmdToExec
  2. Write a new set of integration tests based on the https://github.com/tj/node-growl/blob/master/test.js using the BATS framework.
  3. Using the above BATS test as regression tests, refactor the growl.js and extract all platform specific code into three separate modules (darwin, linux, windows)
  4. Write unit tests for the three platform specific modules
  5. Write another set of unit tests for whatever code remains in the main growl.js module

I believe such a refactor will help us to make the current code easier to test and make it more maintainable in future iterations with platform specific code going into their separate modules.

What do you suggest?

@deiga
Copy link
Collaborator

deiga commented Feb 20, 2018

@hmshwt That sounds wonderful! :) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants