<commit_before>
/**
 * WPCOM module
 */

var WPCOM = require('../');
var Site = require('../lib/site');
var Post = require('../lib/post');
var assert = require('assert');

/**
 * Testing data
 */

var fixture = require('./fixture');

/**
 * WPCOM instance
 */

describe('wpcom.site.post.like', function(){
  // Create `wpcom` and `site` global instances
  var wpcom = WPCOM(fixture.site.token);
  var site = wpcom.site(fixture.site.url);
  var testing_post;

  // Create a testing_post before to start the tests
  before(function(done){
    site.addPost(fixture.post, function (err, data) {
      if (err) throw err;

      testing_post = site.post(data.ID)
      done();
    });
  });

  after(function(done){
    // delete testing_post post
    testing_post.delete(function(err, post) {
      if (err) throw err;

      done();
    });
  });

  describe('wpcom.site.post.like.add', function(){
    it('should add a post like', function(done){
      testing_post
      .like()
      .add(function(err, data){
        if (err) throw err;

        assert.ok(data);
        assert.ok(data.success);
        assert.ok(data.i_like);
        assert.equal(1, data.like_count);

        done();
      });
    });
  });

  describe('wpcom.site.post.like.mine', function(){
    it('should get the post like status of mine', function(done){
      testing_post
      .like()
      .mine(function(err, data){
        if (err) throw err;

        assert.ok(data);
        assert.equal(1, data.like_count);
        assert.ok(data.i_like);

        done();
      });
    });
  });


  describe('wpcom.site.post.like.delete', function(){
    it('should remove your like from the post', function(done){
      testing_post
      .like()
      .del(function(err, data){
        if (err) throw err;

        assert.ok(data);
        assert.ok(data.success);
        assert.equal(0, data.like_count);
        assert.ok(!(data.i_like));

        done();
      });
    });
  });

});<commit_msg>test: add likesList() in post.like file<commit_after>
/**
 * WPCOM module
 */

var WPCOM = require('../');
var Site = require('../lib/site');
var assert = require('assert');

/**
 * Testing data
 */

var fixture = require('./fixture');

/**
 * WPCOM instance
 */

describe('wpcom.site.post.like', function(){
  // Global instances
  var wpcom = WPCOM(fixture.site.token);
  var site = wpcom.site(fixture.site.url);
  var testing_post;

  // Create a testing_post before to start the tests
  before(function(done){
    site.addPost(fixture.post, function (err, data) {
      if (err) throw err;

      testing_post = site.post(data.ID)
      done();
    });
  });

  after(function(done){
    // delete testing_post post
    testing_post.delete(function(err, post) {
      if (err) throw err;

      done();
    });
  });

  describe('wpcom.site.post.like.add', function(){
    it('should add a post like', function(done){
      testing_post
      .like()
      .add(function(err, data){
        if (err) throw err;

        assert.ok(data);
        assert.ok(data.success);
        assert.ok(data.i_like);
        assert.equal(1, data.like_count);

        done();
      });
    });
  });

  describe('wpcom.site.post.like.mine', function(){
    it('should get the post like status of mine', function(done){
      testing_post
      .like()
      .mine(function(err, data){
        if (err) throw err;

        assert.ok(data);
        assert.equal(1, data.like_count);
        assert.ok(data.i_like);

        done();
      });
    });
  });

  describe('wpcom.site.post.likesList', function(){
    it('should get post likes list', function(done){
      testing_post
      .likesList(function(err, data){
        if (err) throw err;

        assert.ok(data);

        assert.equal('number', typeof data.found);
        assert.equal('boolean', typeof data.i_like);
        assert.equal('object', typeof data.likes);
        assert.ok(data.likes instanceof Array);

        done();
      });
    });
  });

  describe('wpcom.site.post.like.delete', function(){
    it('should remove your like from the post', function(done){
      testing_post
      .like()
      .del(function(err, data){
        if (err) throw err;

        assert.ok(data);
        assert.ok(data.success);
        assert.equal(0, data.like_count);
        assert.ok(!(data.i_like));

        done();
      });
    });
  });

});
{'fraction_non_alphanumeric': 0.1677345537757437, 'fraction_numerical': 0.0013729977116704805, 'mean_word_length': 2.3545663852647736, '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': '5880019', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1394, 'n_words': 305}