{"size": 862, "ext": "js", "max_stars_repo_path": "test/lib/config-test.js", "max_stars_repo_name": "monkeysppp/leagues", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/lib/config-test.js", "max_issues_repo_name": "monkeysppp/leagues", "max_issues_repo_issues_event_min_datetime": "2021-01-18T22:39:15.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-15T04:33:28.000Z", "max_forks_repo_path": "test/lib/config-test.js", "max_forks_repo_name": "monkeysppp/leagues", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 21.0243902439, "max_line_length": 47, "alphanum_fraction": 0.5208816705}
'use strict'

const chai = require('chai')
const expect = chai.expect
const proxyquire = require('proxyquire')

describe('config', () => {
  context('when NODE_ENV is set', () => {
    let config

    beforeEach(() => {
      process.env.NODE_ENV = 'development'
      config = proxyquire('../../lib/config', {
        '../config/development.json': {
          key: 'value-dev'
        }
      })
    })

    it('uses the value', () => {
      expect(config.key).to.equal('value-dev')
    })
  })

  context('when NODE_ENV is not set', () => {
    let config
    beforeEach(() => {
      delete process.env.NODE_ENV
      config = proxyquire('../../lib/config', {
        '../config/production.json': {
          key: 'value-prod'
        }
      })
    })

    it('defaults to production', () => {
      expect(config.key).to.equal('value-prod')
    })
  })
})
