{"size": 964, "ext": "js", "max_stars_repo_path": "test/index.js", "max_stars_repo_name": "Tommytrg/api-yandex-wrapper", "max_stars_repo_stars_event_min_datetime": "2018-10-17T12:32:15.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-17T12:32:15.000Z", "max_issues_repo_path": "test/index.js", "max_issues_repo_name": "Tommytrg/api-yandex-wrapper", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/index.js", "max_forks_repo_name": "Tommytrg/api-yandex-wrapper", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.7037037037, "max_line_length": 108, "alphanum_fraction": 0.6721991701}
require('dotenv').config({path: '../.env'});

const chai = require('chai');
const expect =  require('chai').expect;

const apiWrapper = require('../index.js');
const apiKey = process.env.API_KEY;

describe('function getLanguageList', () => {
  it('should return an object with dirs key that contain a non empty array', async () => {    
    const result = await apiWrapper.getLanguageList(process.env.API_KEY_YANDEX_TRANSLATE);
    expect(result).to.be.a('object');
    expect(result).to.include.all.keys('dirs')
    expect(result.dirs).to.be.an('array').that.is.not.empty;
  });
});

describe('function translateText', () => {
  it('should return text translated', async () => {
    const result = await apiWrapper.translateText(process.env.API_KEY_YANDEX_TRANSLATE, 'es-en', 'Francia');
    expect(result).to.be.a('object');
    expect(result.code).to.equal(200)
    expect(result.lang).to.equal('es-en');
    expect(result.text[0]).to.equal('France')
  });
});
