summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/custom-@@hasInstance.js
blob: c0808ce0fcf124a46337010926d7e3ef9d10d6bf (plain)
1
2
3
4
5
6
7
8
9
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();
});