From 2a6bfabc302ec83298f3ae03eb33b0b15eb9d843 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Sun, 28 Jan 2024 18:12:17 +0530 Subject: [PATCH] pr(#1461): addressed review comments --- packages/bruno-common/src/utils/index.spec.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/bruno-common/src/utils/index.spec.ts b/packages/bruno-common/src/utils/index.spec.ts index ced325323..09689ac65 100644 --- a/packages/bruno-common/src/utils/index.spec.ts +++ b/packages/bruno-common/src/utils/index.spec.ts @@ -36,4 +36,16 @@ describe('flattenObject', () => { const output = flattenObject(input); expect(output).toEqual({}); }); + + it('should handle an object with duplicate keys - dot notation used to define the last duplicate key', () => { + const input = { a: { b: 2 }, 'a.b': 1 }; + const output = flattenObject(input); + expect(output).toEqual({ 'a.b': 1 }); + }); + + it('should handle an object with duplicate keys - inner object used to define the last duplicate key', () => { + const input = { 'a.b': 1, a: { b: 2 } }; + const output = flattenObject(input); + expect(output).toEqual({ 'a.b': 2 }); + }); });