const R = require('../../rambda')

test('with undefined', () => {
  const result = R.pathOr('foo', 'x.y', { x : { y : 1 } })

  expect(result).toEqual(1)
})

test('with null', () => {
  const result = R.pathOr('foo', 'x.y', null)

  expect(result).toEqual('foo')
})

test('with NaN', () => {
  const result = R.pathOr('foo', 'x.y', NaN)

  expect(result).toEqual('foo')
})

test('curry case (x)(y)(z)', () => {
  const result = R.pathOr('foo')('x.y.z')({ x : { y : { a : 1 } } })

  expect(result).toEqual('foo')
})

test('curry case (x)(y,z)', () => {
  const result = R.pathOr('foo', 'x.y.z')({ x : { y : { a : 1 } } })

  expect(result).toEqual('foo')
})

test('curry case (x,y)(z)', () => {
  const result = R.pathOr('foo')('x.y.z', { x : { y : { a : 1 } } })

  expect(result).toEqual('foo')
})
