summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Map/groupBy/map-instance.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Map/groupBy/map-instance.js')
-rw-r--r--js/src/tests/test262/built-ins/Map/groupBy/map-instance.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Map/groupBy/map-instance.js b/js/src/tests/test262/built-ins/Map/groupBy/map-instance.js
new file mode 100644
index 0000000000..c033eeda07
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/groupBy/map-instance.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2023 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-map.groupby
+description: Map.groupBy returns a Map instance
+info: |
+ Map.groupBy ( items, callbackfn )
+
+ ...
+
+ 2. Let map be ! Construct(%Map%).
+ ...
+ 4. Return map.
+
+ ...
+features: [array-grouping, Map]
+---*/
+
+const array = [1, 2, 3];
+
+const map = Map.groupBy(array, function (i) {
+ return i % 2 === 0 ? 'even' : 'odd';
+});
+
+assert.sameValue(map instanceof Map, true);
+
+reportCompare(0, 0);