{"size": 838, "ext": "js", "max_stars_repo_path": "source/whereEq.spec.js", "max_stars_repo_name": "farwayer/rambda", "max_stars_repo_stars_event_min_datetime": "2019-06-30T15:33:01.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-30T15:33:01.000Z", "max_issues_repo_path": "source/whereEq.spec.js", "max_issues_repo_name": "farwayer/rambda", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "source/whereEq.spec.js", "max_forks_repo_name": "farwayer/rambda", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.829787234, "max_line_length": 40, "alphanum_fraction": 0.5835322196}
import { whereEq } from './whereEq'

test('when true', () => {
  const rule = { a : 1 }
  const input = {
    a : 1,
    b : 2,
  }

  const result = whereEq(rule, input)
  const expectedResult = true

  expect(result).toEqual(expectedResult)
})

test('when false', () => {
  const rule = { a : 1 }
  const input = { b : 2 }

  const result = whereEq(rule, input)
  const expectedResult = false

  expect(result).toEqual(expectedResult)
})

test('with nested object', () => {
  const rule = { a : { b : 1 } }
  const input = {
    a : { b : 1 },
    c : 2,
  }

  const result = whereEq(rule)(input)
  const expectedResult = true

  expect(result).toEqual(expectedResult)
})

test('with wrong input', () => {
  const rule = { a : { b : 1 } }
  const input = null

  const result = whereEq(rule)(input)

  expect(result).toEqual(false)
})
