Skip to content

Changes for consolidation #768

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

Merged
merged 31 commits into from
Oct 21, 2021
Merged

Conversation

lvlte
Copy link
Contributor

@lvlte lvlte commented Oct 9, 2021

Full switch to ESM.
Remove live code examples (either convert to Jest test or leave hints as a comment).
Remove all console.log (except if encapsulated within a specific method/function).
Revise all algorithms logging results instead of returning them.
...

Fixes #720

@lvlte lvlte requested a review from raklaptudirm as a code owner October 9, 2021 15:57
@raklaptudirm
Copy link
Member

Is this done? If it is not, please convert the pr to draft.

@lvlte
Copy link
Contributor Author

lvlte commented Oct 9, 2021

Nope, there is a lot more to do... converting to draft.

@lvlte lvlte marked this pull request as draft October 9, 2021 16:55
@raklaptudirm
Copy link
Member

@lvlte Please try to avoid using the jest mock functions. Remove the console logs wherever possible, and only use the mock functions where the console logs are a part of the solution.

@lvlte
Copy link
Contributor Author

lvlte commented Oct 10, 2021

That is what I'm doing : algorithms having a print/view/display method rely on console.log, which I leave (in this case only) as a default output callback. Such callback can then be overriden by a mock function so that expected results can be checked by Jest with expect(result).toBe(something).

For logs that are used to print results on the fly as they appears (outside of a print function), I use an output array where the results are pushed, and return the output.

All other logs & live code that don't tell what result is expected are removed, and their content is left as a comment when it gives useful information.

@raklaptudirm raklaptudirm added feature Adds a new feature in progress Being worked on labels Oct 10, 2021
@lvlte
Copy link
Contributor Author

lvlte commented Oct 11, 2021

Hi @raklaptudirm and all,

This is strange, this commit 9218a5c causes the build to fail, but I don't get why.

The error says : Cannot find module '../romanToDecimal' from 'Conversions/test/RomanToDecimal.test.js'
Though the import is just import { romanToDecimal } from '../romanToDecimal'

Do you have any idea ?
On my side all tests pass, included this one.

[EDIT] : this is fixed, it was a typo (lower instead of uppercase), which on my (Windows) machine does not make a difference.

@lvlte
Copy link
Contributor Author

lvlte commented Oct 11, 2021

It was tedious but I think I'm finally done with this PR.

@lvlte lvlte marked this pull request as ready for review October 11, 2021 14:39
@lvlte lvlte mentioned this pull request Oct 13, 2021
@defaude
Copy link
Contributor

defaude commented Oct 14, 2021

[EDIT] : this is fixed, it was a typo (lower instead of uppercase), which on my (Windows) machine does not make a difference.

Ahh, the good old case-insensitive file system stuff 😺

Copy link
Contributor

@defaude defaude left a comment

Choose a reason for hiding this comment

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

Holy crap, you've been hella busy!!

tbh I did not review all 155 changed files thoroughly but as far as I can tell, this looks nice. 👍

@defaude
Copy link
Contributor

defaude commented Oct 14, 2021

I'd even recommend:

Fixes #720

@lvlte
Copy link
Contributor Author

lvlte commented Oct 15, 2021

Thanks, I've added the keyword in the PR description.

@raklaptudirm
Copy link
Member

@cclauss a review please.

@raklaptudirm raklaptudirm requested a review from cclauss October 15, 2021 13:23
@raklaptudirm raklaptudirm removed the in progress Being worked on label Oct 15, 2021
@raklaptudirm raklaptudirm merged commit d38ebe5 into TheAlgorithms:master Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidating some things
3 participants