Fix groupBy string test keys to be insertion order

This commit is contained in:
Shu-yu Guo 2024-04-11 14:57:05 -07:00 committed by Philip Chimento
parent e11ef85b1b
commit 0c43c587cc
2 changed files with 2 additions and 2 deletions

View File

@ -17,6 +17,6 @@ const map = Map.groupBy(string, function (char) {
return char < '🙏' ? 'before' : 'after';
});
assert.compareArray(Array.from(map.keys()), ['before', 'after']);
assert.compareArray(Array.from(map.keys()), ['after', 'before']);
assert.compareArray(map.get('before'), ['💩', '😈']);
assert.compareArray(map.get('after'), ['🥰', '🙏']);

View File

@ -17,6 +17,6 @@ const obj = Object.groupBy(string, function (char) {
return char < '🙏' ? 'before' : 'after';
});
assert.compareArray(Object.keys(obj), ['before', 'after']);
assert.compareArray(Object.keys(obj), ['after', 'before']);
assert.compareArray(obj.before, ['💩', '😈']);
assert.compareArray(obj.after, ['🥰', '🙏']);