summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/Proxy.js
blob: e38165828ccda75cc134218c923a3e3b71c16ae4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
load("test-common.js");

try {
    new Proxy({}, {});

    assertThrowsError(() => {
        new Proxy();
    }, {
        error: TypeError,
        message: "Proxy requires at least two arguments",
    });

    assertThrowsError(() => {
        Proxy();
    }, {
        error: TypeError,
        message: "Proxy must be called with the \"new\" operator",
    });

    assertThrowsError(() => {
        new Proxy(1, {});
    }, {
        error: TypeError,
        message: "Expected target argument of Proxy constructor to be object, got 1",
    });

    console.log("PASS");
} catch (e) {
    console.log("FAIL: " + e);
}