mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Libraries: Move to Userland/Libraries/
This commit is contained in:
parent
dc28c07fa5
commit
13d7c09125
1857 changed files with 266 additions and 274 deletions
37
Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js
Normal file
37
Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
test("constructs properly", () => {
|
||||
expect(() => {
|
||||
new Proxy({}, {});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
test("constructor argument count", () => {
|
||||
expect(() => {
|
||||
new Proxy();
|
||||
}).toThrowWithMessage(TypeError, "Proxy constructor requires at least two arguments");
|
||||
|
||||
expect(() => {
|
||||
new Proxy({});
|
||||
}).toThrowWithMessage(TypeError, "Proxy constructor requires at least two arguments");
|
||||
});
|
||||
|
||||
test("constructor requires objects", () => {
|
||||
expect(() => {
|
||||
new Proxy(1, {});
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Expected target argument of Proxy constructor to be object, got 1"
|
||||
);
|
||||
|
||||
expect(() => {
|
||||
new Proxy({}, 1);
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Expected handler argument of Proxy constructor to be object, got 1"
|
||||
);
|
||||
});
|
||||
|
||||
test("constructor must be invoked with 'new'", () => {
|
||||
expect(() => {
|
||||
Proxy({}, {});
|
||||
}).toThrowWithMessage(TypeError, "Proxy constructor must be called with 'new'");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue