소스 검색

LibJS: Fix tests that expected wrong this values

davidot 4 년 전
부모
커밋
a49b47bfe6

+ 5 - 0
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();
         });
 

+ 5 - 0
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();
         });