{"size": 1438, "ext": "js", "max_stars_repo_path": "tests/register-config.js", "max_stars_repo_name": "janardhan3333/frock", "max_stars_repo_stars_event_min_datetime": "2015-12-25T04:27:04.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-03T09:04:53.000Z", "max_issues_repo_path": "tests/register-config.js", "max_issues_repo_name": "janardhan3333/frock", "max_issues_repo_issues_event_min_datetime": "2015-12-29T20:09:58.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-11T15:56:11.000Z", "max_forks_repo_path": "tests/register-config.js", "max_forks_repo_name": "janardhan3333/frock", "max_forks_repo_forks_event_min_datetime": "2016-01-28T13:31:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-26T12:52:33.000Z"}
{"max_stars_count": 163, "max_issues_count": 15, "max_forks_count": 19, "avg_line_length": 21.4626865672, "max_line_length": 77, "alphanum_fraction": 0.6418636996}
/**
 * Copyright 2015 Urban Airship Inc. and Contributors. Subject to the LICENSE
 * file at the top-level directory of this distribution and at
 * https://github.com/urbanairship/frock/blob/master/LICENSE
 */
const test = require('tape')
const proxyquire = require('proxyquire')

const fakeModule = require('./stubs/fake-module')
const fakeBole = fakeModule({}, ['debug', 'warn', 'error', 'info'])

const lib = proxyquire(
  '../lib/register-config',
  {
    'bole': fakeBole.mock,
    '@noCallThru': true
  }
)

test(`setup ${__filename}`, t => {
  t.plan(1)

  t.pass('set it up')
})

test('registers new config', t => {
  t.plan(2)

  const instance = lib()
  const config = {
    connection: {
      whitelist: ['whatever']
    },
    item: ['something']
  }
  const written = instance.register(config)

  /* eslint-disable eqeqeq */
  t.ok(config != written, 'should return a duplicated object')
  /* eslint-enable eqeqeq */
  t.deepEqual(written, instance.get(), 'can retrieve current config')
})

test('adds default whitelist when not present', t => {
  t.plan(1)

  const instance = lib()
  const config = {
    item: ['something']
  }
  const expected = {
    connection: {
      whitelist: lib.DEFAULT_WHITELIST
    },
    item: ['something']
  }
  const written = instance.register(config)

  t.deepEqual(written, expected, 'whitelist added')
})

test(`teardown ${__filename}`, t => {
  t.plan(1)

  t.pass('tore it down')
})
