{"size": 860, "ext": "js", "max_stars_repo_path": "tests/test.js", "max_stars_repo_name": "ericrange/Spearman-RHO", "max_stars_repo_stars_event_min_datetime": "2016-11-26T08:02:40.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-14T01:17:36.000Z", "max_issues_repo_path": "tests/test.js", "max_issues_repo_name": "ericrange/Spearman-RHO", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/test.js", "max_forks_repo_name": "ericrange/Spearman-RHO", "max_forks_repo_forks_event_min_datetime": "2020-01-13T22:38:00.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-31T23:52:15.000Z"}
{"max_stars_count": 9, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 26.875, "max_line_length": 72, "alphanum_fraction": 0.526744186}
"use strict";

const _ = require('lodash');
const Spearman = require('../spearman-rho');

describe('Calculating some examples...', function() {

  it('#1: 0.6829', function(done) {
    let x = [2.0, 3.0, 3.0, 5.0, 5.5, 8.0, 10.0, 10.0];
    let y = [1.5, 1.5, 4.0, 3.0, 1.0, 5.0, 5.0, 9.5];

    let spearman = new Spearman(x, y);
    spearman.calc()
      .then(result => {
        _.isEqual(0.6829268292682927, result) ? done() : done(result);
      })
      .catch(err => console.error(err));
  });

  it('#1: -0.1758', function(done) {
    let x = [106, 86, 100, 101, 99, 103, 97, 113, 112, 110];
    let y = [7, 0, 27, 50, 28, 29, 20, 12, 6, 17];

    let spearman = new Spearman(x, y);
    spearman.calc()
      .then(result => {
        _.isEqual(-0.17575757575757575, result) ? done() : done(result);
      })
      .catch(err => done(err));
  });

});