summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidot <david.tuin@gmail.com>2021-07-12 01:38:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-20 23:45:28 +0200
commita49b47bfe6afa5c4a36473c07ee9f2de805c7d75 (patch)
treea2508917b14020e22df2a9c4482eb06b677fd506
parentc6e9c6d6ab7fb68b6a9cbabab255c87b8d63395e (diff)
downloadserenity-a49b47bfe6afa5c4a36473c07ee9f2de805c7d75.zip
LibJS: Fix tests that expected wrong this values
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js5
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js5
2 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js
index 110dcf8e1a..68dd0bf2e1 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js
@@ -25,6 +25,11 @@ describe("errors", () => {
describe("normal behavior", () => {
test("basic functionality", () => {
[1, 2].reduce(function () {
+ expect(this).toBe(globalThis);
+ });
+
+ [1, 2].reduce(function () {
+ "use strict";
expect(this).toBeUndefined();
});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js
index 0a3f4acad9..d939ed3ada 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js
@@ -25,6 +25,11 @@ describe("errors", () => {
describe("normal behavior", () => {
test("basic functionality", () => {
[1, 2].reduceRight(function () {
+ expect(this).toBe(globalThis);
+ });
+
+ [1, 2].reduceRight(function () {
+ "use strict";
expect(this).toBeUndefined();
});