<commit_before>var should = require('should'),
    queixinhas_db = require('../lib/db/db');

// Change the default BD configs
queixinhas_db.db_name = 'queixinhas_tests';

describe('MongoDB accesser', function(){
  it('should save, load and remove a document in the database', function(done){
    var value = Date.now();

    queixinhas_db.save('test', {value: value}, function(error, id){

      queixinhas_db.load('test', id, function(error, docs){
        docs[0].value.should.equal(value);

        queixinhas_db.remove('test', id, function(error, docs){

          queixinhas_db.load('test', id, function(error, docs){
            docs.length.should.equal(0);

            done();
          })
        });
      });
    });
  });	
});<commit_msg>Add test to the update method on the DAL<commit_after>var should = require('should'),
    queixinhas_db = require('../lib/db/db');

// Change the default BD configs
queixinhas_db.db_name = 'queixinhas_tests';

describe('MongoDB accesser', function(){
  it('should save, load, modify and remove a document in the database', function(done){
    var value = Date.now();

    queixinhas_db.save('test', {value: value}, function(error, id){

      queixinhas_db.load('test', id, function(error, docs){
        docs[0].value.should.equal(value);

        var new_value = Date.now();

        queixinhas_db.update('test', id, {value: new_value}, function(error, doc){
          doc.value.should.equal(new_value);
        
          queixinhas_db.remove('test', id, function(error, docs){

            queixinhas_db.load('test', id, function(error, docs){
              docs.length.should.equal(0);

              done();
            });
          });
        });
      });
    });
  });	
});
{'fraction_non_alphanumeric': 0.16032295271049596, 'fraction_numerical': 0.002306805074971165, 'mean_word_length': 2.8131868131868134, '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': '1812341', 'n_tokens_mistral': 571, 'n_tokens_neox': 545, 'n_words': 117}