Answer the question
In order to leave comments, you need to log in
Why does the function in chai isBelow not want to accept a string?
There is a test in which you need to check if the string "test" > "rest" is allowed. To do this, chai assert has the isBelow function.
documentation
link to full documentation
says that it accepts mixed. means it must accept a string.
but when I insert a line it displays an error screen
that it was expected either a number or a date.
Maybe someone has come across this.
Answer the question
In order to leave comments, you need to log in
Mixed is some kind of wet fantasy of the authors of chai - this type is not in JS, not even in TS or Flow. If separately somewhere in the docks it is not indicated that Mixed is for example number | string, then it remains only to look at the source and try to understand from use what exactly was meant. Apparently, it meant “anything and different every time”, sooooo useful documentation :)
Judging by the code , only Data and number are accepted.
How not to suffer expect('test' > 'rest').to.be.true;
:. It seems counter-intuitive, but in fact, such tests are easier to read and maintain.
strings are not checked that way. isBelow() is a number comparison, useassert.equal('123', '4564', 'not equal')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question