{"size": 1772, "ext": "js", "max_stars_repo_path": "test/unit/config/env/resolveConfig.test.js", "max_stars_repo_name": "merico-dev/build-backend", "max_stars_repo_stars_event_min_datetime": "2021-05-28T00:45:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-29T00:45:04.000Z", "max_issues_repo_path": "test/unit/config/env/resolveConfig.test.js", "max_issues_repo_name": "merico-dev/build-backend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/unit/config/env/resolveConfig.test.js", "max_forks_repo_name": "merico-dev/build-backend", "max_forks_repo_forks_event_min_datetime": "2021-06-02T01:26:28.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-08T14:17:00.000Z"}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 36.1632653061, "max_line_length": 73, "alphanum_fraction": 0.651241535}
const chai = require('chai')
const { expect } = chai
const decache = require('decache');

const environments = require('../../../../config/constants/environments')

const originalNodeEnv = process.env.NODE_ENV

describe('resolveConfig', () => {
  afterEach(() => {
    process.env.NODE_ENV = originalNodeEnv;
  })

  it ('returns staging.js if its staging', () => {
    decache('../../../../config/env/resolveConfig')
    process.env.NODE_ENV = environments.staging
    const config = require('../../../../config/env/resolveConfig')
    expect(config.custom.ENV_STRING).to.equal(environments.staging)
  })

  it ('returns sandbox.js if its sandbox', () => {
    decache('../../../../config/env/resolveConfig')
    process.env.NODE_ENV = environments.sandbox
    const config = require('../../../../config/env/resolveConfig')
    expect(config.custom.ENV_STRING).to.equal(environments.sandbox)
  })

  it ('returns testing.js if its testing', () => {
    decache('../../../../config/env/resolveConfig')
    process.env.NODE_ENV = environments.testing
    const config = require('../../../../config/env/resolveConfig')
    expect(config.custom.ENV_STRING).to.equal(environments.testing)
  })

  it ('returns benchmark.js if its benchmark', () => {
    decache('../../../../config/env/resolveConfig')
    process.env.NODE_ENV = environments.benchmark
    const config = require('../../../../config/env/resolveConfig')
    expect(config.custom.ENV_STRING).to.equal(environments.benchmark)
  })

  it ('returns local.js if its anything else', () => {
    decache('../../../../config/env/resolveConfig')
    process.env.NODE_ENV = 'nanananana'
    const config = require('../../../../config/env/resolveConfig')
    expect(config.custom.ENV_STRING).to.equal('jon-local')
  })
})
