From 1d0812ce0a6b551f865cc03e258b4746ed803f15 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Fri, 20 Nov 2020 19:17:47 +0200 Subject: [PATCH] Fix test --- js/bundle_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/bundle_test.go b/js/bundle_test.go index 14028f3f2bd..46cc510fe4d 100644 --- a/js/bundle_test.go +++ b/js/bundle_test.go @@ -114,12 +114,17 @@ func TestNewBundle(t *testing.T) { } }) t.Run("CompatibilityMode", func(t *testing.T) { + compatibilityTestSrc := ` + module.exports.default = function() {}; + if ([[1,2],[3,4]].flatten()[4] == 4) { + throw Error("Array.flatten doesn't work") + } + ` t.Run("Extended/ok/CoreJS", func(t *testing.T) { rtOpts := lib.RuntimeOptions{ CompatibilityMode: null.StringFrom(lib.CompatibilityModeExtended.String()), } - _, err := getSimpleBundle(t, "/script.js", - `module.exports.default = function() {}; new Promise(function(resolve, reject){});`, rtOpts) + _, err := getSimpleBundle(t, "/script.js", compatibilityTestSrc, rtOpts) assert.NoError(t, err) }) @@ -156,8 +161,8 @@ func TestNewBundle(t *testing.T) { // some ES2015 objects polyfilled by core.js are not supported { "CoreJS", "base", - `module.exports.default = function() {}; new Promise(function(resolve, reject){});`, - "ReferenceError: Promise is not defined at file:///script.js:1:45(5)", + compatibilityTestSrc, + "TypeError: Object has no member 'flatten' at file:///script.js:3:28(14)", }, }