JavaScript
Show that something is out of range

by Benny Neugebauer

it('throws an error when out of range', () => {
  const encoder = new CBOR.Encoder();
  expect(() => encoder.u16(0xFFFFFFFF + 1)).toThrowError(RangeError);
});

it('throws an error when out of range', () => {
  const encoder = new CBOR.Encoder();
  expect(() => encoder.u16(4294967296)).toThrowError(RangeError);
});