3

Is it possible to use assert.equal method in Node.js like this:

assert.equal(some_var, 12 OR 34);

If some_var is 12 or 34 I need the test to have passed.

2 Answers 2

1

you can do like this

expect([12, 34]).to.include(some_var);

i usually use chai to do unit test, but the concept should be the same.

Sign up to request clarification or add additional context in comments.

Comments

1

No dependencies

assert([12, 34].includes(some_var));

It actually ends up 2 characters less than the chai solution

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.