custom-@@hasInstance.js 258 B

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