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

Updated tests #684

Draft
wants to merge 23 commits into
base: main-enterprise
Choose a base branch
from
Draft

Updated tests #684

wants to merge 23 commits into from

Conversation

Gramatus
Copy link
Contributor

@Gramatus Gramatus commented Sep 15, 2024

This is so far a WiP, but I am trying to see if I can get those tests that are currently skipped to work.

I have managed to run all the tests in index.test.js, branches.test.js and milestones.test.js, but I am not completely certain that all the tests actually checks what they should. I will try to look into that later. I believe this is still a good way towards better testing.

One important thing to note is that I added title to MergeDeep.NAME_FIELDS in order to make milestones work. I am not sure if this might have unintended consequences, and would be happy if someone else has any insights into that.

I also added a few JSDoc types (for my own understanding of the code), hopefully that is not a problem.

Finally, I fixed a few places where I believe the logging was wrong (see 6f205c3).

@Gramatus
Copy link
Contributor Author

@decyjphr does this look promising? It might be a few weeks before I can continue, but if this is interesting I will try to make sure all the tests in this PR works and does what is expected.

Gramatus and others added 18 commits October 5, 2024 16:55
These were added as part of understanding the code, commiting in case they might be useful for others as well.
This is what probot actually uses to identify the org, so it should probably be there in the fixture.
When `sender.type` is bot, the change is skipped. This led to the test checking for changes on this event failing.
This seems to me to be the best way for logs to show up in a useful fashion when running tests.
This is needed for the test to be able to check that it was called.
Also adds support for ovveriding the filter list in `Diffable.sync`.
This is needed for milestones to work correctly. However, it should be tested well to ensure it does not break anything else.
I believe this change makes the logic easier to follow, especially not returning data that does not need to be returned.
This change should give the exact same result, except moving the `else`-block within the try/catch (and I don't see why that is bad).

The refactor makes it easier to understand the difference in logic with and without a present `repoConfig` by only having the actual alternate action within the if/else and keeping the bit that always happen outside the if/else.
Linting failed in deploymentConfig.js due to the static fields. Eslint supports this from ecmaVersion 13.
The full test suite failed because it tried to lint the tests, while the running linter did not do the same. Enabling linting gave errors due to jest having undef stuff, but overriding these files for jest env keeps the linting without these errors.
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

Successfully merging this pull request may close these issues.

2 participants