-
-
Notifications
You must be signed in to change notification settings - Fork 834
test: add more unit tests #462
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 issues found across 4 files
Prompt for AI agents (all 6 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="tests/converters/dasel.test.ts">
<violation number="1" location="tests/converters/dasel.test.ts:58">
P1: Missing `await` before `expect(...).rejects`. Without `await`, this assertion won't be properly evaluated and the test could pass incorrectly.</violation>
<violation number="2" location="tests/converters/dasel.test.ts:63">
P1: Missing `await` before `expect(...).rejects`. Without `await`, this assertion won't be properly evaluated and the test could pass incorrectly.</violation>
</file>
<file name="tests/converters/vtracer.test.ts">
<violation number="1" location="tests/converters/vtracer.test.ts:54">
P1: Missing `await` before `expect().rejects.toMatch()`. Without `await`, the async test completes before the rejection assertion is evaluated, causing this test to pass even if the promise doesn't reject or rejects with a different message. Add `await` to properly wait for the assertion.</violation>
</file>
<file name="tests/converters/pandoc.test.ts">
<violation number="1" location="tests/converters/pandoc.test.ts:62">
P1: Missing `await` before `expect(...).rejects`. Without `await`, this test will pass even if the promise doesn't reject as expected, since the assertion runs asynchronously after the test completes.</violation>
</file>
<file name="tests/converters/libreoffice.test.ts">
<violation number="1" location="tests/converters/libreoffice.test.ts:111">
P1: Missing `await` before `.resolves` assertion. Without awaiting, this test will always pass regardless of what the promise resolves to.</violation>
<violation number="2" location="tests/converters/libreoffice.test.ts:118">
P1: Missing `await` before `.rejects` assertion. Without awaiting, this test will always pass regardless of whether the promise rejects.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
2f03037 to
31f45ee
Compare
31f45ee to
0521af0
Compare
C4illin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
|
I have been thinking about doing tests testing files as well, do you think it would be worth it? |
I think it would be worth adding tests for every file that has some crucial logic in it. I mainly started with the converters because they are essentially the core of the app. But the main.ts is still untested. And everything else besides the types could be tested as well. |
|
I wrote my message a bit confusing, I meant testing the conversion flow calling the converters directly. I am opposed to this since it mostly tests other peoples code and not this project, but also almost all errors that come up are related to some conversion that needs some extra parameter. I do agree with that testing more of the app would be nice as well :) |
|
Feel free to merge this when you feel done as well |
I see, but I think that can be part of the test of the main.ts and other parts? Although that test of the whole application/conversion flow would go towards integration tests rather than unit tests. But then again, integration tests would also be very useful to find errors with new converters. |
Summary by cubic
Add unit tests for dasel, libreoffice, pandoc, and vtracer converters to verify CLI args, options mapping, output writing, logging, and error handling. Coverage includes soffice filters/outdir, pandoc PDF engine, vtracer options, and dasel file writes.
Written for commit 0521af0. Summary will update automatically on new commits.