Newer
Older
minerva / Userland / Libraries / LibJS / Tests / custom-@@hasInstance.js
@minerva minerva on 13 Jul 258 bytes Initial commit
test("basic functionality", () => {
    function Foo() {}
    Object.defineProperty(Foo, Symbol.hasInstance, {
        value: instance => instance === 2,
    });

    expect(new Foo() instanceof Foo).toBeFalse();
    expect(2 instanceof Foo).toBeTrue();
});