Math.abs.js 440 B

1234567891011121314
  1. test("basic functionality", () => {
  2. expect(Math.abs).toHaveLength(1);
  3. expect(Math.abs("-1")).toBe(1);
  4. expect(Math.abs(-2)).toBe(2);
  5. expect(Math.abs(null)).toBe(0);
  6. expect(Math.abs("")).toBe(0);
  7. expect(Math.abs([])).toBe(0);
  8. expect(Math.abs([2])).toBe(2);
  9. expect(Math.abs([1, 2])).toBeNaN();
  10. expect(Math.abs({})).toBeNaN();
  11. expect(Math.abs("string")).toBeNaN();
  12. expect(Math.abs()).toBeNaN();
  13. });