var expect  = require('chai').expect;
var helpers = require('./helpers');

describe('Helpers', function() {
  it('Should be an object', function() {
    expect(helpers).to.be.a('object');
  });
  describe('Methods', function() {
    describe('seedDependencies', function() {
      it('Should be a function', function() {
        expect(helpers.seedDependencies).to.be.a('function');
      });
    });
    describe('gatherDetails', function() {
      it('Should be a function', function() {
        expect(helpers.gatherDetails).to.be.a('function');
      });
    });
    describe('fetchModuleDownloads', function() {
      it('Should be a function', function() {
        expect(helpers.fetchModuleDownloads).to.be.a('function');
      });
    });
  });
});

import { expect } from 'chai';
import { NpmConfig } from './helpers';

describe('Helpers', function() {
  describe('NpmConfig', () => {
    const deps = {
        "lodash": "4.17.2",
        "ramda": "0.22.1"
    };
    it('should be a factory that returns a config object', () => {
      expect(NpmConfig).to.be.a('function');
      const obj = NpmConfig(deps);
      expect(obj).to.be.an('object');
      expect(obj).to.deep.equal({
        hostname: 'api.npmjs.org',
        path: '/downloads/point/last-month/lodash,ramda',
        method: 'GET',
        headers: {
          'User-Agent': 'cachilders/backpat'
        }
      });
    });
  });
});

write test for NpmConfig factory