Browse Source

LibJS: Fix tests that expected wrong this values

davidot 4 years ago
parent
commit
a49b47bfe6

+ 5 - 0
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js

@@ -25,6 +25,11 @@ describe("errors", () => {
 describe("normal behavior", () => {
 describe("normal behavior", () => {
     test("basic functionality", () => {
     test("basic functionality", () => {
         [1, 2].reduce(function () {
         [1, 2].reduce(function () {
+            expect(this).toBe(globalThis);
+        });
+
+        [1, 2].reduce(function () {
+            "use strict";
             expect(this).toBeUndefined();
             expect(this).toBeUndefined();
         });
         });
 
 

+ 5 - 0
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js

@@ -25,6 +25,11 @@ describe("errors", () => {
 describe("normal behavior", () => {
 describe("normal behavior", () => {
     test("basic functionality", () => {
     test("basic functionality", () => {
         [1, 2].reduceRight(function () {
         [1, 2].reduceRight(function () {
+            expect(this).toBe(globalThis);
+        });
+
+        [1, 2].reduceRight(function () {
+            "use strict";
             expect(this).toBeUndefined();
             expect(this).toBeUndefined();
         });
         });