<commit_before>/* Copyright (c) 2013 <NAME> */
"use strict";


// run memcached for this to work!

var seneca = require('seneca')()
seneca.use('..')


var assert = require('assert')


describe('memcached', function(){

  var cache = seneca.pin({role:'cache',cmd:'*'})

  it('set1', function(cb) {
    cache.set({key:'a1',val:'b1'},function(err,out){
      assert.ok(null==err)
      assert.equal(out,true)
      cb()
    })
  })


  it('get1', function(cb) {
    cache.get({key:'a1'},function(err,out){
      assert.ok(null==err)
      assert.equal('b1',out)
      cb()
    })
  })


  it('set2', function(cb) {
    cache.set({key:'c1',val:0},function(err,out){
      assert.ok(null==err)
      assert.ok(out)
      cb()
    })
  })

  it('incr1', function(cb) {
    cache.incr({key:'c1',val:1},function(err,out){
      assert.ok(null==err)
      assert.ok(out)
      cb()
    })
  })

  it('get2', function(cb) {
    cache.get({key:'c1'},function(err,out){
      assert.ok(null==err)
      assert.equal(1,out)
      cb()
    })
  })

  it('incr2', function(cb) {
    cache.incr({key:'c1',val:1},function(err,out){
      assert.ok(null==err)
      assert.ok(out)
      cb()
    })
  })

  it('get3', function(cb) {
    cache.get({key:'c1'},function(err,out){
      assert.ok(null==err)
      assert.equal(2,out)
      cb()
    })
  })

  it('delete', function (cb) {
    cache.delete({key:'c1'},function(err,out){
      assert.ok(null==err)
      assert.equal(out,true)
      cb()
    })
  });

  it('add', function(cb) {
    cache.add({key:'d1',val:'e1'},function(err,out){
      assert.ok(null==err)
      assert.equal(out,true)
      cb()
    })
  })

  it('won\'t add if key already exists', function(cb) {
    cache.add({key:'d1',val:'e2'},function(err,out){
      assert(err)
    })
  })


})<commit_msg>Added missing callback in test<commit_after>/* Copyright (c) 2013 <NAME> */
"use strict";


// run memcached for this to work!

var seneca = require('seneca')()
seneca.use('..')


var assert = require('assert')


describe('memcached', function(){

  var cache = seneca.pin({role:'cache',cmd:'*'})

  it('set1', function(cb) {
    cache.set({key:'a1',val:'b1'},function(err,out){
      assert.ok(null==err)
      assert.equal(out,true)
      cb()
    })
  })


  it('get1', function(cb) {
    cache.get({key:'a1'},function(err,out){
      assert.ok(null==err)
      assert.equal('b1',out)
      cb()
    })
  })


  it('set2', function(cb) {
    cache.set({key:'c1',val:0},function(err,out){
      assert.ok(null==err)
      assert.ok(out)
      cb()
    })
  })

  it('incr1', function(cb) {
    cache.incr({key:'c1',val:1},function(err,out){
      assert.ok(null==err)
      assert.ok(out)
      cb()
    })
  })

  it('get2', function(cb) {
    cache.get({key:'c1'},function(err,out){
      assert.ok(null==err)
      assert.equal(1,out)
      cb()
    })
  })

  it('incr2', function(cb) {
    cache.incr({key:'c1',val:1},function(err,out){
      assert.ok(null==err)
      assert.ok(out)
      cb()
    })
  })

  it('get3', function(cb) {
    cache.get({key:'c1'},function(err,out){
      assert.ok(null==err)
      assert.equal(2,out)
      cb()
    })
  })

  it('delete', function (cb) {
    cache.delete({key:'c1'},function(err,out){
      assert.ok(null==err)
      assert.equal(out,true)
      cb()
    })
  });

  it('add', function(cb) {
    cache.add({key:'d1',val:'e1'},function(err,out){
      assert.ok(null==err)
      assert.equal(out,true)
      cb()
    })
  })

  it('won\'t add if key already exists', function(cb) {
    cache.add({key:'d1',val:'e2'},function(err,out){
      assert(err)
      cb()
    })
  })


})
{'fraction_non_alphanumeric': 0.22532894736842105, 'fraction_numerical': 0.01644736842105263, 'mean_word_length': 2.8089770354906056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5663692', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1400, 'n_words': 183}