<commit_before>var Code = require('code'),
  Lab = require('lab'),
  lab = exports.lab = Lab.script(),
  describe = lab.experiment,
  before = lab.before,
  after = lab.after,
  beforeEach = lab.beforeEach,
  afterEach = lab.afterEach,
  it = lab.test,
  expect = Code.expect,
  fixtures = require('../fixtures'),
  nock = require('nock');

var server;
var username1 = 'bob';

var userMock, licenseMock;

userMock = nock("https://user-api-example.com")
  .get('/user/bob').times(8)
  .reply(200, fixtures.users.bob)
  .get('/user/seldo').times(3)
  .reply(200, fixtures.users.npmEmployee)
  .get('/user/constructor')
  .reply(200, fixtures.users.propName)
  .get('/user/bob/package?format=mini&per_page=100&page=0').times(10)
  .reply(200, fixtures.users.packages)
  .get('/user/bob/stars?format=detailed').times(10)
  .reply(200, fixtures.users.stars)
  .get('/user/bob').times(5)
  .reply(404)
  .get('/user/seldo')
  .reply(404)
  .get('/user/mikeal')
  .reply(404)
  .get('/user/bob/org').times(2)
  .reply(401)
  .get('/package?sort=modified&count=12')
  .reply(200, fixtures.aggregates.recently_updated_packages)
  .get('/package?sort=dependents&count=12')
  .reply(200, fixtures.aggregates.most_depended_upon_packages);

licenseMock = nock('https://license-api-example.com')
  .get('/customer/bob/stripe').times(13)
  .reply(200, {})
  .get('/customer/mikeal/stripe')
  .reply(200, {})
  .get('/customer/seldo/stripe').times(4)
  .reply(200, {});

before(function(done) {
  require('../mocks/server')(function(obj) {
    server = obj;
    done();
  });
});

after(function(done) {
  userMock.done();
  licenseMock.done();
  done();
});

describe("bonbon", function() {

  beforeEach(function(done) {
    process.env.NODE_ENV = 'production';
    done();
  });<commit_msg>Mock redis in bonbon test<commit_after>var Code = require('code'),
  Lab = require('lab'),
  lab = exports.lab = Lab.script(),
  describe = lab.experiment,
  before = lab.before,
  after = lab.after,
  beforeEach = lab.beforeEach,
  afterEach = lab.afterEach,
  it = lab.test,
  expect = Code.expect,
  fixtures = require('../fixtures'),
  nock = require('nock');
var requireInject = require('require-inject');
var redisMock = require('redis-mock');

var server;
var username1 = 'bob';

var userMock, licenseMock;

userMock = nock("https://user-api-example.com")
  .get('/user/bob').times(8)
  .reply(200, fixtures.users.bob)
  .get('/user/seldo').times(3)
  .reply(200, fixtures.users.npmEmployee)
  .get('/user/constructor')
  .reply(200, fixtures.users.propName)
  .get('/user/bob/package?format=mini&per_page=100&page=0').times(10)
  .reply(200, fixtures.users.packages)
  .get('/user/bob/stars?format=detailed').times(10)
  .reply(200, fixtures.users.stars)
  .get('/user/bob').times(5)
  .reply(404)
  .get('/user/seldo')
  .reply(404)
  .get('/user/mikeal')
  .reply(404)
  .get('/user/bob/org').times(2)
  .reply(401)
  .get('/package?sort=modified&count=12')
  .reply(200, fixtures.aggregates.recently_updated_packages)
  .get('/package?sort=dependents&count=12')
  .reply(200, fixtures.aggregates.most_depended_upon_packages);

licenseMock = nock('https://license-api-example.com')
  .get('/customer/bob/stripe').times(13)
  .reply(200, {})
  .get('/customer/mikeal/stripe')
  .reply(200, {})
  .get('/customer/seldo/stripe').times(4)
  .reply(200, {});

before(function(done) {
  requireInject.installGlobally('../mocks/server', {
    redis: redisMock
  })(function(obj) {
    server = obj;
    done();
  });
});

after(function(done) {
  userMock.done();
  licenseMock.done();
  done();
});

describe("bonbon", function() {

  beforeEach(function(done) {
    process.env.NODE_ENV = 'production';
    done();
  });
{'fraction_non_alphanumeric': 0.20556455969746082, 'fraction_numerical': 0.03349540788762831, 'mean_word_length': 4.171787709497207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1744918', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1365, 'n_words': 189}