mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:07:34 +00:00
LibJS: Fix Object.prototype.valueOf() behavior
No idea why it was implemented like this, but a value_of() call on the coerced object is not part of the spec. Also added some tests.
This commit is contained in:
parent
1253a3d038
commit
33eea1f722
2 changed files with 9 additions and 4 deletions
|
@ -0,0 +1,8 @@
|
|||
test("basic functionality", () => {
|
||||
expect(Object.prototype.valueOf).toHaveLength(0);
|
||||
|
||||
const o = {};
|
||||
expect(o.valueOf()).toBe(o);
|
||||
|
||||
expect(Object.prototype.valueOf.call(42)).toEqual(new Number(42));
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue