custom-@@hasInstance.js 230 B

123456789
  1. test("basic functionality", () => {
  2. function Foo() {}
  3. Foo[Symbol.hasInstance] = value => {
  4. return value === 2;
  5. };
  6. expect(new Foo() instanceof Foo).toBeFalse();
  7. expect(2 instanceof Foo).toBeTrue();
  8. });