jest-community / jest-extended

Additional Jest matchers 🃏💪
https://jest-extended.jestcommunity.dev/
MIT License
2.32k stars 223 forks source link

'toBeHexadecimal' is a disguise name #196

Open sergiuchuckmisha opened 5 years ago

sergiuchuckmisha commented 5 years ago

First of all: I understand that, according to documentation, behavior is correct. What I mean is that name of method toBeHexadecimal is disguise. toBeHTMLHexadecimalColor or toBeHexadecimalColor would be better naming.

Bug

Relevant code or config

expect("cb2f450864cceab1632939e35554d20cc8d9f38e688fa1e68a4b408f90b1f978").toBeHexadecimal();

What you did: tried to verify is string a valid hash

What happened (please provide anything you think will help): test failed Reproduction repository (if possible): not possible

Possible solution:

hiwelo commented 4 years ago

👍

Is there any update regarding this issue? I would definitely push for the removal of the size requirement for the toBeHexadecimal matcher, especially because the current matcher is not even working with the "new" format of hexadecimal colors that can have up to 8 chars (when having alpha information for the color).

In this case, we could have:

Another solution would be to have only toBeHexadecimal as a matcher for all hexadecimal string with an optional parameter with a maximum amount of chars for the provided string.