{"size": 1553, "ext": "js", "max_stars_repo_path": "test/profile.test.js", "max_stars_repo_name": "jaredhanson/passport-foursquare", "max_stars_repo_stars_event_min_datetime": "2015-03-17T07:28:09.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-14T15:40:49.000Z", "max_issues_repo_path": "test/profile.test.js", "max_issues_repo_name": "jaredhanson/passport-foursquare", "max_issues_repo_issues_event_min_datetime": "2017-02-08T23:25:59.000Z", "max_issues_repo_issues_event_max_datetime": "2017-02-08T23:55:25.000Z", "max_forks_repo_path": "test/profile.test.js", "max_forks_repo_name": "jaredhanson/passport-foursquare", "max_forks_repo_forks_event_min_datetime": "2015-03-17T07:28:10.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-29T03:02:58.000Z"}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": 6, "avg_line_length": 29.3018867925, "max_line_length": 74, "alphanum_fraction": 0.596909208}
/* global describe, it, expect, before */
/* jshint expr: true */

var fs = require('fs')
  , parse = require('../lib/profile').parse;


describe('profile.parse', function() {
    
  describe('profile using API version 20120504', function() {
    var profile;
    
    before(function(done) {
      fs.readFile('test/data/20120504.json', 'utf8', function(err, data) {
        if (err) { return done(err); }
        profile = parse(data);
        done();
      });
    });
    
    it('should parse profile', function() {
      expect(profile.id).to.equal('1419');
      expect(profile.name.familyName).to.equal('Hanson');
      expect(profile.name.givenName).to.equal('Jared');
      expect(profile.gender).to.equal('male');
      expect(profile.emails).to.have.length(1);
      expect(profile.emails[0].value).to.equal('jaredhanson@example.com');
    });
  });
  
  describe('profile using API version 20140308', function() {
    var profile;
    
    before(function(done) {
      fs.readFile('test/data/20140308.json', 'utf8', function(err, data) {
        if (err) { return done(err); }
        profile = parse(data);
        done();
      });
    });
    
    it('should parse profile', function() {
      expect(profile.id).to.equal('1419');
      expect(profile.name.familyName).to.equal('Hanson');
      expect(profile.name.givenName).to.equal('Jared');
      expect(profile.gender).to.equal('male');
      expect(profile.emails).to.have.length(1);
      expect(profile.emails[0].value).to.equal('jaredhanson@example.com');
    });
  });
  
});
