<commit_before>var expect = require('chai').expect
    should = require('chai').should()
    sinon = require('sinon')
    proxyquire = require('proxyquire').noCallThru()
    path = require('path')

describe('update', function () {
    var update,
        _mocks,
        _deps,
        _got,
        _res,
        _cache,
        _file,
        _unpack,
        _directory,
        _logger

    beforeEach(function () {
        _deps = {
            context: { 
                name: 'test',
                appDir: '/test'
            },
            dependencies: [],
            plugins: []
        }
        _res = { on: sinon.stub() }
        _got = sinon.stub().returns(_res)
        _cache = {
            get: sinon.stub()
        }
        _file = {
            readJson: sinon.stub(),
            writeJson: sinon.stub()
        }
        _directory = {
            create: sinon.stub(),
            remove: sinon.stub(),
            appDir: sinon.stub().returns('/test')
        }
        _unpack = {

        }
        _logger = {
            log: sinon.stub(),
            info: sinon.stub(),
            warn: sinon.stub(),
            error: sinon.stub(),
            debug: sinon.stub()
        }
        _mocks = {
            'got': _got,
            './unpack.js': _unpack,
            './cache.js': _cache,
            './file.js': _file,
            './directory.js': _directory,
            './logger.js': _logger
        }
        update = proxyquire('../lib/update.js', _mocks)

        _got.withArgs(sinon.match.string, {json:true}).callsArgWith(2, null, { versions: { '1.0.0': {}, '1.0.1': {} }, dist: { tarball: 'http://test.com/update.tgz' } })
        _cache.get.callsArgWith(5, null)
        _file.readJson.callsArgWith(1, null, { dependencies: {} })
        _file.writeJson.callsArgWith(2, null)
        _directory.create.callsArgWith(1, null)
        _directory.remove.callsArgWith(1, null)
    })
<commit_msg>fix update tests<commit_after>var expect = require('chai').expect
    should = require('chai').should()
    sinon = require('sinon')
    proxyquire = require('proxyquire').noCallThru()
    path = require('path')

describe('update', function () {
    var update,
        _mocks,
        _deps,
        _got,
        _res,
        _cache,
        _file,
        _unpack,
        _directory,
        _logger

    beforeEach(function () {
        _deps = {
            context: { 
                name: 'test',
                appDir: '/test'
            },
            dependencies: [],
            plugins: []
        }
        _res = { on: sinon.stub() }
        _got = sinon.stub().returns(_res)
        _cache = {
            get: sinon.stub()
        }
        _file = {
            readJson: sinon.stub(),
            writeJson: sinon.stub()
        }
        _directory = {
            create: sinon.stub(),
            remove: sinon.stub(),
            appDir: sinon.stub().returns('/test')
        }
        _unpack = {

        }
        _logger = {
            log: sinon.stub(),
            info: sinon.stub(),
            warn: sinon.stub(),
            error: sinon.stub(),
            debug: sinon.stub()
        }
        _mocks = {
            'got': _got,
            './unpack.js': _unpack,
            './cache.js': _cache,
            './file.js': _file,
            './directory.js': _directory,
            './logger.js': _logger
        }
        update = proxyquire('../lib/update.js', _mocks)

        _got.withArgs(sinon.match.string, {json:true}).callsArgWith(2, null, { versions: { '1.0.0': {}, '1.0.1': {} }, dist: { tarball: 'http://test.com/update.tgz' } })
        _cache.get.callsArgWith(6, null)
        _file.readJson.callsArgWith(1, null, { dependencies: {} })
        _file.writeJson.callsArgWith(2, null)
        _directory.create.callsArgWith(1, null)
        _directory.remove.callsArgWith(1, null)
    })

{'fraction_non_alphanumeric': 0.15186615186615188, 'fraction_numerical': 0.006177606177606178, 'mean_word_length': 1.461051298290057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '71455', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1238, 'n_words': 204}