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