<commit_before>var poor = utils.unexpected({bool: true, arr: true, num: true, str: true});

function assert(a, views, likes, comments) {
  a.stats.should.be.an.instanceof(Object);
  a.stats.should.have.properties(['views', 'likes', 'comments']);

  a.stats.views.should.equal(views);
  a.stats.likes.should.equal(likes);
  a.stats.comments.should.equal(comments);
}

it('should works', function() {
  var a = new Yamb({stats: {
    views: 10,
    comments: 5,
    likes: 20
  }});

  assert(a, 10, 20, 5);
});

it('should always work with numbers', function() {
  var a = new Yamb();

  a.stats.views++;
  a.stats.views++;

  a.stats = {likes: '10'};

  a.stats.comments = '100';
  a.stats.comments++;

  assert(a, 2, 10, 101);
});

it('should not be able to delete a property', function() {
  var a = new Yamb();
  a.stats = {views: 10, comments: '5', likes: '100'};

  delete a.stats.comments;
  a.stats.comments.should.equal(5);

  var stats = a.stats;

  delete stats.likes;
  a.stats.likes.should.equal(100);
});

it('should not update with unexpected values from constructor', function() {
  var a;

  for (var i=0, length=poor.length; i<length; i++) {
    a = new Yamb({stats: poor[i]});
    assert(a, schema.data.stats.views, schema.data.stats.likes, schema.data.stats.comments);
  }

  a = new Yamb({stats: {
    views: '10',
    comments: '5',
    likes: '20'
  }});

  assert(a, schema.data.stats.views, schema.data.stats.likes, schema.data.stats.comments);
});

it('should not update with unexpected values from setter', function() {
  var a;

  for (var i=0, length=poor.length; i<length; i++) {
    a = new Yamb();
    a.stats = poor[i];

    assert(a, schema.data.stats.views, schema.data.stats.likes, schema.data.stats.comments);
  }
});<commit_msg>More tests for stats property<commit_after>var poor = utils.unexpected({bool: true, arr: true, num: true, str: true});
var defaults = schema.data.stats;

function assert(a, views, likes, comments) {
  a.stats.should.be.an.instanceof(Object);
  a.stats.should.have.properties(['views', 'likes', 'comments']);

  a.stats.views.should.equal(views);
  a.stats.likes.should.equal(likes);
  a.stats.comments.should.equal(comments);
}

it('should works', function() {
  var a = new Yamb({stats: {
    views: 10,
    comments: 5,
    likes: 20
  }});

  assert(a, 10, 20, 5);
});

it('should always work with numbers', function() {
  var a = new Yamb();

  a.stats.views++;
  a.stats.views++;

  a.stats = {likes: '10'};

  a.stats.comments = '100';
  a.stats.comments++;

  assert(a, 2, 10, 101);
});

it('should not be able to delete a property', function() {
  var a = new Yamb();
  a.stats = {views: 10, comments: '5', likes: '100'};

  delete a.stats.comments;
  a.stats.comments.should.equal(5);

  var stats = a.stats;

  delete stats.likes;
  a.stats.likes.should.equal(100);
});

it('should not update with unexpected values from constructor', function() {
  var a;

  for (var i=0, length=poor.length; i<length; i++) {
    a = new Yamb({stats: poor[i]});
    assert(a, defaults.views, defaults.likes, defaults.comments);
  }

  a = new Yamb({stats: {
    views: '10',
    comments: '5',
    likes: '20'
  }});

  assert(a, defaults.views, defaults.likes, defaults.comments);
});

it('should not update with unexpected values from setter', function() {
  var a;

  for (var i=0, length=poor.length; i<length; i++) {
    a = new Yamb();
    a.stats = poor[i];

    assert(a, defaults.views, defaults.likes, defaults.comments);
  }
});

it('should not set property with unexpected values', function() {
  var a;

  for (var i=0, length=poor.length; i<length; i++) {
    if (typeof poor[i] == 'string' || typeof poor[i] == 'number') {
      continue;
    }

    a = new Yamb();

    a.stats.views = poor[i];
    a.stats.comments = poor[i];
    a.stats.likes = poor[i];

    assert(a, defaults.views, defaults.likes, defaults.comments);
  }
});
{'fraction_non_alphanumeric': 0.18433179723502305, 'fraction_numerical': 0.01971326164874552, 'mean_word_length': 3.501152073732719, 'pattern_counts': {'":': 0, '<': 8, '<?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': '5960172', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1396, 'n_words': 352}