X Tutup
Skip to content

Changes for consolidation#768

Merged
raklaptudirm merged 31 commits intoTheAlgorithms:masterfrom
lvlte:issues/720
Oct 21, 2021
Merged

Changes for consolidation#768
raklaptudirm merged 31 commits intoTheAlgorithms:masterfrom
lvlte:issues/720

Conversation

@lvlte
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@lvlte
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

defaude commented Oct 14, 2021

I'd even recommend:

Fixes #720

@lvlte
Copy link
Copy Markdown
Contributor Author

lvlte commented Oct 15, 2021

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

@raklaptudirm
Copy link
Copy Markdown
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

X Tutup