Test cases for js-ast-utils/is-binary #1047
Conversation
Signed-off-by: Nikhil Thomas <nikhil@arceoanalytics.com>
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.
Thanks for working on this! The copyright header isn't necessary on any new files. We only have to keep it on files that already have it.
Awesome! Is "isn't necessary" the same as "please delete" or "next time don't worry about it" - I'm happy to add a change, just want to make sure I'm doing the copyright-thing right |
Yes, please delete the header. Also, I think it's better to use |
Signed-off-by: Nikhil Thomas <nikhil@arceoanalytics.com>
import {parseJS} from "@internal/js-parser"; | ||
import {jsExpressionStatement} from "@internal/ast"; | ||
|
||
function binaryExpressionHelper(input: string) { |
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.
function binaryExpressionHelper(input: string) { | |
function binaryExpressionHelper(input: string): boolean { |
Nit: Explicit return types where possible.
} | ||
|
||
test( | ||
"isBinary", |
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.
We might want to give a better wording here
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.
I can be more explicit - I was looking at a few other tests (sort.test.ts, parse.test.ts) and didn't see very lengthy test names
Signed-off-by: Nikhil Thomas <nikhil@arceoanalytics.com>
Part of #1023
Summary
This PR adds test cases for the
isBinary
utility checking binary and non-binary expressions (unary, arrays).Note: I wasn't sure if the copyright header was needed but I saw it in other tests I used as samples, so I kept it. Please let me know if it needs to change.
Test Plan
It runs and passes with
./rome test internal/js-ast-utils/isBinary.test.ts
No changes to other tests, so
./rome test
still passes (I've verified)