<commit_before>var sinon = require('sinon');
var should = require('should');

var smartsheet = null;

describe('Client Unit Tests', function() {
  beforeEach(function() {
    client = require('../');
    smartsheet = client.createClient({accessToken:'1234'});
  });

  afterEach(function() {
    smartsheet = null;
  });

  describe('#Constants', function() {
    it('should have Constants object', function() {
      Object.keys(smartsheet.constants).should.be.length(6);
      smartsheet.should.have.property('constants');
      smartsheet.constants.should.have.property('accessLevel');
      smartsheet.constants.should.have.property('accessScope');
      smartsheet.constants.should.have.property('types');
      smartsheet.constants.should.have.property('paperSize');
      smartsheet.constants.should.have.property('acceptHeaders');
      smartsheet.constants.should.have.property('sheet');
    });
  });

  describe('#Contacts', function() {
    it('should have Contacts object', function() {
      smartsheet.should.have.property('contacts');
      Object.keys(smartsheet.contacts).should.be.length(2);
    });

    it('should have Contacts GET methods', function() {
      smartsheet.contacts.should.have.property('getContact');
      smartsheet.contacts.should.have.property('listContacts');
    });

    it('should return correct response from getContact', function() {
      const contacts = require('../lib/contacts');
      const getContactExpectedResponse = {
          "id": "AAAAATYU54QAD7_fNhTnhA",
          "name": "<NAME>",
          "email": "<EMAIL>"
      }

      const httpUtilsGetMock = {
        get: function(optionsToSend, callback) {
          callback(getContactExpectedResponse)
        }
      };

      const theContact = contacts.create({
        apiUrls: {contacts: '...'},
        httpUtils: httpUtilsGetMock
      });

      theContact.getContact({id: "AAAAATYU54QAD7_fNhTnhA"}, (data) => {
        should.deepEqual(data, getContactExpectedResponse);
      });
    });

    it('should return correct response from listContacts', function() {
      const contacts = require('../lib/contacts');
      const listContactsExpectedResponse = {
          "pageNumber": 1,
          "pageSize": 100,
          "totalPages": 1,
          "totalCount": 2,
          "data": [
              {
                  "id": "AAAAATYU54QAD7_fNhTnhA",
                  "name": "<NAME>",
                  "email": "<EMAIL>"
              },
              {
                  "id": "AAAAATYU54QAH7_fNhTnhA",
                  "name": "<NAME>",
                  "email": "<EMAIL>"
              }
          ]
      }

      const httpUtilsGetMock = {
        get: function(optionsToSend, callback) {
          callback(getContactExpectedResponse)
        }
      };

      const theContact = contacts.create({
        apiUrls: {contacts: '...'},
        httpUtils: httpUtilsGetMock
      });

      theContact.listContacts({}, (data) => {
        should.deepEqual(data, listContactsExpectedResponse);
      });
    });
  });

  describe('#Favorites', function() {
    it('should have Favorites object',function(){
      smartsheet.should.have.property('favorites');
      Object.keys(smartsheet.favorites).should.be.length(17);
    });

    it('should have get methods', function() {
      smartsheet.favorites.should.have.property('listFavorites');
    });

    it('should have create methods', function() {
      smartsheet.favorites.should.have.property('addItemsToFavorites');
      smartsheet.favorites.should.have.property('addSheetToFavorites');
      smartsheet.favorites.should.have.property('addFolderToFavorites');
      smartsheet.favorites.should.have.property('addReportToFavorites');
      smartsheet.favorites.should.have.property('addTemplateToFavorites');
      smartsheet.favorites.should.have.property('addWorkspaceToFavorites');
    });

    it('should have delete methods', function() {
      smartsheet.favorites.should.have.property('removeSheetFromFavorites');
      smartsheet.favorites.should.have.property('removeWorkspaceFromFavorites');
      smartsheet.favorites.should.have.property('removeFolderFromFavorites');
      smartsheet.favorites.should.have.property('removeTemplateFromFavorites');
      smartsheet.favorites.should.have.property('removeReportFromFavorites');
      smartsheet.favorites.should.have.property('removeSheetsFromFavorites');
      smartsheet.favorites.should.have.property('removeWorkspacesFromFavorites');<commit_msg>Fix unit tests<commit_after>var sinon = require('sinon');
var should = require('should');

var smartsheet = null;

describe('Client Unit Tests', function() {
  beforeEach(function() {
    client = require('../');
    smartsheet = client.createClient({accessToken:'1234'});
  });

  afterEach(function() {
    smartsheet = null;
  });

  describe('#Constants', function() {
    it('should have Constants object', function() {
      Object.keys(smartsheet.constants).should.be.length(6);
      smartsheet.should.have.property('constants');
      smartsheet.constants.should.have.property('accessLevel');
      smartsheet.constants.should.have.property('accessScope');
      smartsheet.constants.should.have.property('types');
      smartsheet.constants.should.have.property('paperSize');
      smartsheet.constants.should.have.property('acceptHeaders');
      smartsheet.constants.should.have.property('sheet');
    });
  });

  describe('#Contacts', function() {
    it('should have Contacts object', function() {
      smartsheet.should.have.property('contacts');
      Object.keys(smartsheet.contacts).should.be.length(2);
    });

    it('should have Contacts GET methods', function() {
      smartsheet.contacts.should.have.property('getContact');
      smartsheet.contacts.should.have.property('listContacts');
    });

    it('should return correct response from getContact', function() {
      const contacts = require('../lib/contacts');
      const getContactExpectedResponse = {
          "id": "AAAAATYU54QAD7_fNhTnhA",
          "name": "<NAME>",
          "email": "<EMAIL>"
      }

      const httpUtilsGetMock = {
        get: function(optionsToSend, callback) {
          callback(getContactExpectedResponse)
        }
      };

      const theContact = contacts.create({
        apiUrls: {contacts: '...'},
        httpUtils: httpUtilsGetMock
      });

      theContact.getContact({id: "AAAAATYU54QAD7_fNhTnhA"}, (data) => {
        should.deepEqual(data, getContactExpectedResponse);
      });
    });

    it('should return correct response from listContacts', function() {
      const contacts = require('../lib/contacts');
      const listContactsExpectedResponse = {
          "pageNumber": 1,
          "pageSize": 100,
          "totalPages": 1,
          "totalCount": 2,
          "data": [
              {
                  "id": "AAAAATYU54QAD7_fNhTnhA",
                  "name": "<NAME>",
                  "email": "<EMAIL>"
              },
              {
                  "id": "AAAAATYU54QAH7_fNhTnhA",
                  "name": "<NAME>",
                  "email": "<EMAIL>"
              }
          ]
      }

      const httpUtilsGetMock = {
        get: function(optionsToSend, callback) {
          callback(getContactExpectedResponse)
        }
      };

      const theContact = contacts.create({
        apiUrls: {contacts: '...'},
        httpUtils: httpUtilsGetMock
      });

      theContact.listContacts({}, (data) => {
        should.deepEqual(data, listContactsExpectedResponse);
      });
    });
  });

  describe('#Favorites', function() {
    it('should have Favorites object',function(){
      smartsheet.should.have.property('favorites');
      Object.keys(smartsheet.favorites).should.be.length(20);
    });

    it('should have get methods', function() {
      smartsheet.favorites.should.have.property('listFavorites');
    });

    it('should have create methods', function() {
      smartsheet.favorites.should.have.property('addItemsToFavorites');
      smartsheet.favorites.should.have.property('addSheetToFavorites');
      smartsheet.favorites.should.have.property('addFolderToFavorites');
      smartsheet.favorites.should.have.property('addReportToFavorites');
      smartsheet.favorites.should.have.property('addTemplateToFavorites');
      smartsheet.favorites.should.have.property('addSightToFavorites');
      smartsheet.favorites.should.have.property('addWorkspaceToFavorites');
    });

    it('should have delete methods', function() {
      smartsheet.favorites.should.have.property('removeSheetFromFavorites');
      smartsheet.favorites.should.have.property('removeSightFromFavorites');
      smartsheet.favorites.should.have.property('removeWorkspaceFromFavorites');
      smartsheet.favorites.should.have.property('removeFolderFromFavorites');
      smartsheet.favorites.should.have.property('removeTemplateFromFavorites');
      smartsheet.favorites.should.have.property('removeReportFromFavorites');
      smartsheet.favorites.should.have.property('removeSheetsFromFavorites');
      smartsheet.favorites.should.have.property('removeSightsFromFavorites');
      smartsheet.favorites.should.have.property('removeWorkspacesFromFavorites');
{'fraction_non_alphanumeric': 0.142283481658346, 'fraction_numerical': 0.005643585847623182, 'mean_word_length': 3.031058617672791, 'pattern_counts': {'":': 28, '<': 15, '<?xml version=': 0, '>': 19, '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': '2680058', 'n_tokens_mistral': 2674, 'n_tokens_neox': 2617, 'n_words': 356}