i need expectation in jasmine, like:
let realvalue = callsomemethod(); let expected = [{ total: 33, saved: 1.65 }]; expect(realvalue).toequal(expected);
but fails, , message is:
expect [ object({ total: 33, saved: 1.6500000000000001 })] equal [object({ total: 33, saved: 1.65 })].
how can right checking?
the tobecloseto
matcher precision math comparison:
expect(1.6500000000000001).tobecloseto(1.65, 2); expect(1.6500000000000001).tobecloseto(1.65, 15); expect(1.6500000000000001).not.tobecloseto(1.65, 16);
source: jasmine matchers
Comments
Post a Comment