<commit_before>// Author Test File
var db = require('../tmp/db.js');
var assert = require('assert');

var author = {
    name: 'Slash',
    email: '<EMAIL>',
 };

var author_update = {
    name: 'Morbid',
    email: '<EMAIL>',
}

var author_id;

describe('Author Table Test', function(){

    it('Should save new author', function(done){
       db.saveAuthor(author).then(function(status){
           //console.log(status);
	   author_id = status.generated_keys[0];
	   done();    
       }, function(err){     
           done(err);
       });
    })

    it('Should get author data based on id', function(done){
       db.getAuthorById(author_id).then(function(data) {
          //console.log(data);
          assert.equal(data.name,author.name, 'Author name ');
	  done();
       }, function(err){
          done(err);
       });   
    });
/**
    it('Should update post', function(){
       
       post_update.generated_keys = [post_id];

       db.updatePost(post_update).then(function(data){
           //console.log(data);
           assert.equal(1, data.replaced, 'replaced (updated) should be 1');
	   done();
       }, function(err){
           done(err);
       });
    })
*/

    it('Should delete author with specified id', function(done){
       db.deleteAuthor(author_id).then(function(result){
           //console.log(result);
	   assert.equal(1, result.deleted, 'deleted should be 1');
	   done();
       }, function(err){
           done(err);
       })
    })
})<commit_msg>Add test for author update<commit_after>// Author Test File
var db = require('../tmp/db.js');
var assert = require('assert');

var author = {
    name: 'Slash',
    email: '<EMAIL>',
 };

var author_update = {
    name: 'Morbid',
    email: '<EMAIL>',
}

var author_id;

describe('Author Table Test', function(){

    it('Should save new author', function(done){
       db.saveAuthor(author).then(function(status){
           //console.log(status);
	   author_id = status.generated_keys[0];
	   done();    
       }, function(err){     
           done(err);
       });
    })

    it('Should get author data based on id', function(done){
       db.getAuthorById(author_id).then(function(data) {
          //console.log(data);
          assert.equal(data.name,author.name, 'Author name ');
	  done();
       }, function(err){
          done(err);
       });   
    });

    it('Should update author data', function(){
       
       author_update.generated_keys = [author_id];

       db.updateAuthor(author_update).then(function(data){
           //console.log(data);
           assert.equal(1, data.replaced, 'replaced (updated) should be 1');
	   done();
       }, function(err){
           done(err);
       });
    })

    it('Should delete author with specified id', function(done){
       db.deleteAuthor(author_id).then(function(result){
           //console.log(result);
	   assert.equal(1, result.deleted, 'deleted should be 1');
	   done();
       }, function(err){
           done(err);
       })
    })
})
{'fraction_non_alphanumeric': 0.16556071665560718, 'fraction_numerical': 0.0033178500331785005, 'mean_word_length': 2.309549945115258, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3056791', 'n_tokens_mistral': 935, 'n_tokens_neox': 909, 'n_words': 189}