<commit_before>( function _FileProvider_Git_test_ss_( ) {

'use strict'; 

if( typeof module !== 'undefined' )
{
  let _ = require( '../../Tools.s' );

  _.include( 'wTesting' );

  require( '../files/UseTop.s' );
}

//

var _ = _global_.wTools;

//

function onSuiteBegin( test )
{
  let context = this;

  context.providerSrc = _.FileProvider.Git();
  context.providerDst = _.FileProvider.HardDrive();
  context.hub = _.FileProvider.Hub({ providers : [ context.providerSrc, context.providerDst ] });

  let path = context.providerDst.path;

  context.testSuitePath = path.dirTempOpen( 'FileProviderGit' );
  context.testSuitePath = context.providerDst.pathResolveLinkFull({ filePath : context.testSuitePath, resolvingSoftLink : 1 });
}

function onSuiteEnd( test )
{
  let context = this;
  let path = context.providerDst.path;
  _.assert( _.strHas( context.testSuitePath, 'FileProviderGit' ) );
  path.dirTempClose( context.testSuitePath );
}

// --
// tests
// --

function filesReflectTrivial( test )
{
  let context = this;
  let providerSrc = context.providerSrc;
  let providerDst = context.providerDst;
  let hub = context.hub;
  let path = context.providerDst.path;
  let testPath = path.join( context.testSuitePath, 'routine-' + test.name );
  let localPath = path.join( testPath, 'wPathFundamentals' );
  let clonePathGlobal = providerDst.globalFromLocal( localPath );

  let con = new _.Consequence().take( null )

  .thenKeep( () =>
  {
    test.case = 'no hash, no trailing /';
    providerDst.filesDelete( localPath );
    let remotePath = 'git+https:///github.com/Wandalen/wPathFundamentals.git';
    return hub.filesReflect({ reflectMap : { [ remotePath ] : clonePathGlobal }});
  })
  .thenKeep( ( got ) =>
  {
    let files = providerDst.filesFind
    ({
      filePath : localPath,
      includingTerminals : 1,
      includingDirs : 1,
      outputFormat : 'relative',
      recursive : 2
    });<commit_msg>Git.test.ss: skip test suite if dependency is not installed<commit_after>( function _FileProvider_Git_test_ss_( ) {

'use strict'; 

if( typeof module !== 'undefined' )
{
  let _ = require( '../../Tools.s' );

  _.include( 'wTesting' );
  
  try
  {
    require( 'gitconfiglocal' )
  }
  catch( err )
  { 
    return;
  }

  require( '../files/UseTop.s' );
}

//

var _ = _global_.wTools;

//

function onSuiteBegin( test )
{
  let context = this;

  context.providerSrc = _.FileProvider.Git();
  context.providerDst = _.FileProvider.HardDrive();
  context.hub = _.FileProvider.Hub({ providers : [ context.providerSrc, context.providerDst ] });

  let path = context.providerDst.path;

  context.testSuitePath = path.dirTempOpen( 'FileProviderGit' );
  context.testSuitePath = context.providerDst.pathResolveLinkFull({ filePath : context.testSuitePath, resolvingSoftLink : 1 });
}

function onSuiteEnd( test )
{
  let context = this;
  let path = context.providerDst.path;
  _.assert( _.strHas( context.testSuitePath, 'FileProviderGit' ) );
  path.dirTempClose( context.testSuitePath );
}

// --
// tests
// --

function filesReflectTrivial( test )
  let context = this;
  let providerSrc = context.providerSrc;
  let providerDst = context.providerDst;
  let hub = context.hub;
  let path = context.providerDst.path;
  let testPath = path.join( context.testSuitePath, 'routine-' + test.name );
  let localPath = path.join( testPath, 'wPathFundamentals' );
  let clonePathGlobal = providerDst.globalFromLocal( localPath );

  let con = new _.Consequence().take( null )

  .thenKeep( () =>
  {
    test.case = 'no hash, no trailing /';
    providerDst.filesDelete( localPath );
    let remotePath = 'git+https:///github.com/Wandalen/wPathFundamentals.git';
    return hub.filesReflect({ reflectMap : { [ remotePath ] : clonePathGlobal }});
  })
  .thenKeep( ( got ) =>
  {
    let files = providerDst.filesFind
    ({
      filePath : localPath,
      includingTerminals : 1,
      includingDirs : 1,
      outputFormat : 'relative',
      recursive : 2
    });
{'fraction_non_alphanumeric': 0.1391326146903986, 'fraction_numerical': 0.002005515166708448, 'mean_word_length': 3.413716814159292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '3094063', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1290, 'n_words': 274}