<commit_before>require( "./setup" );
var path = require( "path" );
var git = require( "../src/git.js" );
var repoPath = path.resolve( "./spec/fauxgitaboudit" );

describe( "Git", function() {
	describe( "when getting basic information with default tag", function() {
		var repoInfo;

		before( function( done ) {
			git.repo( repoPath, "o_r_b_v_c_s" )
				.then( function( info ) {
					repoInfo = info;
					done();
				} );
		} );

		it( "should retrieve necessary repository data from environment", function() {
			repoInfo.owner.should.equal( "anonymous" );
			repoInfo.repository.should.equal( "fauxgitaboudit" );
			repoInfo.branch.should.equal( "master" );
			repoInfo.path.should.equal( repoPath );
			repoInfo.build.should.equal( 5 );
			repoInfo.commit.length.should.equal( 40 );
			repoInfo.major.should.equal( "0" );
			repoInfo.minor.should.equal( "1" );
			repoInfo.patch.should.equal( "1" );
			repoInfo.major_version.should.equal( "0" );
			repoInfo.minor_version.should.equal( "0.1" );
			repoInfo.tag.should.equal( "anonymous_fauxgitaboudit_master_" + repoInfo.version + "_5_" + repoInfo.commit.slice( 0, 8 ) );
		} );
	} );

	describe( "when getting basic information with multiple tags", function() {
		var repoInfo;

		before( function( done ) {
			git.repo( repoPath, "v_c_s,miv,ma" )
				.then( function( info ) {
					repoInfo = info;
					done();
				} );
		} );

		it( "should retrieve necessary repository data from environment", function() {
			repoInfo.owner.should.equal( "anonymous" );
			repoInfo.repository.should.equal( "fauxgitaboudit" );
			repoInfo.branch.should.equal( "master" );
			repoInfo.path.should.equal( repoPath );
			repoInfo.build.should.equal( 5 );
			repoInfo.commit.length.should.equal( 40 );
			repoInfo.major.should.equal( "0" );
			repoInfo.minor.should.equal( "1" );
			repoInfo.patch.should.equal( "1" );
			repoInfo.major_version.should.equal( "0" );
			repoInfo.minor_version.should.equal( "0.1" );
			repoInfo.tag.should.eql( [
				repoInfo.version + "_5_" + repoInfo.commit.slice( 0, 8 ),
				"0.1",
				"0"
			] );
		} );
	} );

	describe( "when getting build details from Drone", function() {
		var repoInfo;

		before( function() {
			process.env.DRONE = true;
			process.env.DRONE_BRANCH = "testing";
      process.env.DRONE_REPO_OWNER = "me";
      process.env.DRONE_REPO_NAME = "test";
			return git.repo( repoPath, "o_r_b_v_c_s" )<commit_msg>chore(ci): fix tests for git module in Travis<commit_after>require( "./setup" );
var path = require( "path" );
var git = require( "../src/git.js" );
var repoPath = path.resolve( "./spec/fauxgitaboudit" );

describe( "Git", function() {
  var owner;

  before( function() {
    owner = "anonymous";
    repo = "fauxgitaboudit";
    if( process.env.TRAVIS ) {
      owner = process.env.TRAVIS_REPO_SLUG.split( "/" )[ 0 ];
      repo = process.env.TRAVIS_REPO_SLUG.split( "/" )[ 1 ];
    }
  } );

	describe( "when getting basic information with default tag", function() {
		var repoInfo;

		before( function( done ) {
			git.repo( repoPath, "o_r_b_v_c_s" )
				.then( function( info ) {
					repoInfo = info;
					done();
				} );
		} );

		it( "should retrieve necessary repository data from environment", function() {
			repoInfo.owner.should.equal( owner );
			repoInfo.repository.should.equal( repo );
			repoInfo.branch.should.equal( "master" );
			repoInfo.path.should.equal( repoPath );
			repoInfo.build.should.equal( 5 );
			repoInfo.commit.length.should.equal( 40 );
			repoInfo.major.should.equal( "0" );
			repoInfo.minor.should.equal( "1" );
			repoInfo.patch.should.equal( "1" );
			repoInfo.major_version.should.equal( "0" );
			repoInfo.minor_version.should.equal( "0.1" );
			repoInfo.tag.should.equal( owner + "_" + repo + "_master_" + repoInfo.version + "_5_" + repoInfo.commit.slice( 0, 8 ) );
		} );
	} );

	describe( "when getting basic information with multiple tags", function() {
		var repoInfo;

		before( function( done ) {
			git.repo( repoPath, "v_c_s,miv,ma" )
				.then( function( info ) {
					repoInfo = info;
					done();
				} );
		} );

		it( "should retrieve necessary repository data from environment", function() {
			repoInfo.owner.should.equal( owner );
			repoInfo.repository.should.equal( repo );
			repoInfo.branch.should.equal( "master" );
			repoInfo.path.should.equal( repoPath );
			repoInfo.build.should.equal( 5 );
			repoInfo.commit.length.should.equal( 40 );
			repoInfo.major.should.equal( "0" );
			repoInfo.minor.should.equal( "1" );
			repoInfo.patch.should.equal( "1" );
			repoInfo.major_version.should.equal( "0" );
			repoInfo.minor_version.should.equal( "0.1" );
			repoInfo.tag.should.eql( [
				repoInfo.version + "_5_" + repoInfo.commit.slice( 0, 8 ),
				"0.1",
				"0"
			] );
		} );
	} );

	describe( "when getting build details from Drone", function() {
		var repoInfo;

		before( function() {
			process.env.DRONE = true;
			process.env.DRONE_BRANCH = "testing";
      process.env.DRONE_REPO_OWNER = "me";
      process.env.DRONE_REPO_NAME = "test";
			return git.repo( repoPath, "o_r_b_v_c_s" )
{'fraction_non_alphanumeric': 0.1636435331230284, 'fraction_numerical': 0.011041009463722398, 'mean_word_length': 3.3507718696397943, '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': '2799492', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1774, 'n_words': 353}