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

Refactor JavaScript functions to be testable #47

Open
joeowenca opened this issue Feb 15, 2024 · 0 comments
Open

Refactor JavaScript functions to be testable #47

joeowenca opened this issue Feb 15, 2024 · 0 comments
Labels
refactor issues pertaining to refactoring code

Comments

@joeowenca
Copy link
Owner

joeowenca commented Feb 15, 2024

Move any general JavaScript functions out into their own files so that they can be testable.

Being testable entails:

  1. Passing in arguments to the functions as opposed to relying on external variables
  2. Returning a value from the function, as opposed to modifying an external variable
  3. Essentially, data in, data out

Make the functions 'pure functions'.

@joeowenca joeowenca added the refactor issues pertaining to refactoring code label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor issues pertaining to refactoring code
Projects
None yet
Development

No branches or pull requests

1 participant