From dd99fa7fb1c17a3f6d90ff0f9344b7b582834999 Mon Sep 17 00:00:00 2001 From: swnf <50806201+swnf@users.noreply.github.com> Date: Sun, 2 Oct 2022 19:59:35 +0200 Subject: [PATCH] Array order test case for sortObject --- test/unit/util.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/util.test.ts b/test/unit/util.test.ts index 41b11a43d8d..dffbf48658f 100644 --- a/test/unit/util.test.ts +++ b/test/unit/util.test.ts @@ -139,6 +139,11 @@ describe('util.test.js', () => { const sorted = sortObject(obj); assert.ok(sorted.color.$regex instanceof RegExp); }); + it('should sort object arrays in a deterministic order', () => { + const arr = [{a: 1}, {b: 2}]; + const sorted = sortObject(arr); + assert.deepStrictEqual(sorted, [{a: 1}, {b: 2}]); + }); }); describe('.validateDatabaseName()', () => { describe('positive', () => {