Jest · Matcher
toBeCloseTo
toBeCloseTo checks whether two floating-point numbers are approximately equal. Use it when exact decimal equality could fail because of rounding.
Last updated
Syntax
expect(received).toBeCloseTo(number, numDigits?)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expecttoBetoEqualexpect.closeTo