serenity/Userland/Libraries/LibJS/Tests/custom-@@hasInstance.js
2021-01-12 12:17:46 +01:00

9 lines
230 B
JavaScript

test("basic functionality", () => {
function Foo() {}
Foo[Symbol.hasInstance] = value => {
return value === 2;
};
expect(new Foo() instanceof Foo).toBeFalse();
expect(2 instanceof Foo).toBeTrue();
});