{"size": 1041, "ext": "js", "max_stars_repo_path": "lib/entity-types/entity-entry/reducer.test.js", "max_stars_repo_name": "ozipi/data-point", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/entity-types/entity-entry/reducer.test.js", "max_issues_repo_name": "ozipi/data-point", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/entity-types/entity-entry/reducer.test.js", "max_forks_repo_name": "ozipi/data-point", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.1333333333, "max_line_length": 65, "alphanum_fraction": 0.646493756}
/* eslint-env jest */
'use strict'

const Reducer = require('./reducer')

const FixtureStore = require('../../../test/utils/fixture-store')
const testData = require('../../../test/data.json')

const helpers = require('../../helpers')

let dataPoint
let resolveTransform

function transform (entityId, value, options) {
  const reducer = dataPoint.entities.get(entityId)
  const accumulator = helpers.createAccumulator(
    value,
    Object.assign(
      {
        context: reducer
      },
      options
    )
  )
  return Reducer.resolve(accumulator, resolveTransform)
}

beforeAll(() => {
  dataPoint = FixtureStore.create()
  resolveTransform = helpers.createResolveTransform(dataPoint)
})

describe('Entry.resolve', () => {
  test('Entry#resolve - resolve empty', () => {
    return transform('entry:a0').then(result => {
      expect(result.value).toEqual({})
    })
  })
  test('Entry#resolve - resolve context', () => {
    return transform('entry:a1', testData).then(result => {
      expect(result.value).toEqual(1)
    })
  })
})
