String.fromCharCode.js 792 B

1234567891011121314151617
  1. test("basic functionality", () => {
  2. expect(String.fromCharCode).toHaveLength(1);
  3. expect(String.fromCharCode()).toBe("");
  4. expect(String.fromCharCode(0)).toBe("\u0000");
  5. expect(String.fromCharCode(false)).toBe("\u0000");
  6. expect(String.fromCharCode(null)).toBe("\u0000");
  7. expect(String.fromCharCode(undefined)).toBe("\u0000");
  8. expect(String.fromCharCode(1)).toBe("\u0001");
  9. expect(String.fromCharCode(true)).toBe("\u0001");
  10. expect(String.fromCharCode(-1)).toBe("\uffff");
  11. expect(String.fromCharCode(0xffff)).toBe("\uffff");
  12. expect(String.fromCharCode(0x123ffff)).toBe("\uffff");
  13. expect(String.fromCharCode(65)).toBe("A");
  14. expect(String.fromCharCode(65, 66, 67)).toBe("ABC");
  15. expect(String.fromCharCode(228, 246, 252)).toBe("äöü");
  16. });