mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-11-16 18:10:43 +01:00
18 lines
430 B
TypeScript
18 lines
430 B
TypeScript
import { deepGet } from '../../src/cli/includes/deepGet'
|
|
|
|
describe('deep object handling', () => {
|
|
test('gets a deep property', () => {
|
|
const obj = {
|
|
a: { b: { c: { d: ['foo', 'bar'] } } },
|
|
}
|
|
expect(deepGet(obj, 'a.b.c.d.1')).toBe('bar')
|
|
})
|
|
|
|
test('returns undefined for if some property not found', () => {
|
|
const obj = {
|
|
a: { b: 1 },
|
|
}
|
|
expect(deepGet(obj, 'c.b')).toBe(undefined)
|
|
})
|
|
})
|