|
1 | | -import { inheritAriaAttributes } from './helpers'; |
| 1 | +import { deepMerge, inheritAriaAttributes } from './helpers'; |
2 | 2 |
|
3 | 3 | describe('inheritAriaAttributes', () => { |
4 | 4 | it('should inherit aria attributes', () => { |
@@ -40,3 +40,26 @@ describe('inheritAriaAttributes', () => { |
40 | 40 | }); |
41 | 41 | }); |
42 | 42 | }); |
| 43 | + |
| 44 | +describe('deepMerge', () => { |
| 45 | + it('should merge objects', () => { |
| 46 | + const target = { a: 1, b: 2 }; |
| 47 | + const source = { b: 3, c: 4 }; |
| 48 | + const result = deepMerge(target, source); |
| 49 | + expect(result).toEqual({ a: 1, b: 3, c: 4 }); |
| 50 | + }); |
| 51 | + |
| 52 | + it('should merge objects when target is undefined', () => { |
| 53 | + const target = undefined; |
| 54 | + const source = { a: 1, b: 2 }; |
| 55 | + const result = deepMerge(target, source); |
| 56 | + expect(result).toEqual({ a: 1, b: 2 }); |
| 57 | + }); |
| 58 | + |
| 59 | + it('should merge objects when source is undefined', () => { |
| 60 | + const target = { a: 1, b: 2 }; |
| 61 | + const source = undefined; |
| 62 | + const result = deepMerge(target, source); |
| 63 | + expect(result).toEqual({ a: 1, b: 2 }); |
| 64 | + }); |
| 65 | +}); |
0 commit comments