<commit_before>import mkdirp from 'mkdirp'
import rimraf from 'rimraf'
import fileCache from '../../src/cache/file'

describe('Cache', function() {

  before(function(done) {
    mkdirp('./tmp', done)
  })

  after(function(done) {
    rimraf('./tmp', done)
  })

  describe('file', function() {
    const cache = fileCache({path: './tmp'})

    it('should create cache entry', function(done) {
      cache
        .save('test_id', 'Hello, World!')
        .then(done)
        .catch(done)
    })

    it('should verify that cache entry exists', function(done) {
      cache
        .has('test_id')
        .then(function(val) {
          val.should.eql(true)
          done()
        })
        .catch(done)
    })

    it('should load a cache entry', function(done) {
      cache
        .load('test_id')
        .then(function(val) {
          val.should.be.eql('Hello, World!')
          done()
        })
        .catch(done)
    })

  })

})<commit_msg>test: check if an entry does not exist<commit_after>import mkdirp from 'mkdirp'
import rimraf from 'rimraf'
import fileCache from '../../src/cache/file'

describe('Cache', function() {

  before(function(done) {
    mkdirp('./tmp', done)
  })

  after(function(done) {
    rimraf('./tmp', done)
  })

  describe('file', function() {
    const cache = fileCache({path: './tmp'})

    it('should create cache entry', function(done) {
      cache
        .save('test_id', 'Hello, World!')
        .then(done)
        .catch(done)
    })

    it('should verify that cache entry exists', function(done) {
      cache
        .has('test_id')
        .then(function(val) {
          val.should.eql(true)
          done()
        })
        .catch(done)
    })

    it('should verify that cache entry does not exist', function(done) {
      cache
        .has('does_not_exist')
        .then(function(val) {
          val.should.eql(false)
          done()
        })
        .catch(done)
    })

    it('should load a cache entry', function(done) {
      cache
        .load('test_id')
        .then(function(val) {
          val.should.be.eql('Hello, World!')
          done()
        })
        .catch(done)
    })

  })

})
{'fraction_non_alphanumeric': 0.1620752984389348, 'fraction_numerical': 0.0, 'mean_word_length': 2.0138312586445366, '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': '1956484', 'n_tokens_mistral': 706, 'n_tokens_neox': 686, 'n_words': 148}