Testing and types updates (#39657)

This commit is contained in:
Echo authored and GitHub committed 2026-06-29 14:26:22 +00:00
1 parent b2ebfa13a9
commit 00a8fbc43e
29 files changed
+263 -191

No files matched your search

@@ -2,13 +2,13 @@
import { getNestedProperty } from './objects';
describe('getNestedProperty', () => {
const obj = { a: { b: { c: 42 } } } as const;
test('returns the value of a nested property if it exists', () => {
const obj = { a: { b: { c: 42 } } };
expect(getNestedProperty(obj, 'a', 'b', 'c')).toBe(42);
});
test('returns undefined if any part of the path does not exist', () => {
const obj = { a: { b: { c: 42 } } };
expect(getNestedProperty(obj, 'a', 'x', 'c')).toBeUndefined();
expect(getNestedProperty(obj, 'a', 'b', 'x')).toBeUndefined();
expect(getNestedProperty(obj, 'x', 'b', 'c')).toBeUndefined();
@@ -20,8 +20,7 @@ describe('getNestedProperty', () => {
expect(getNestedProperty('string', 'a', 'b')).toBeUndefined();
});
test('returns undefined if no keys are provided', () => {
const obj = { a: 1 };
expect(getNestedProperty(obj)).toBeUndefined();
test('returns the object if no keys are provided', () => {
expect(getNestedProperty({ a: 1 })).toStrictEqual({ a: 1 });
});
});