<commit_before>'use strict';

require('mocha');
var assert = require('assert');
var repoName = require('./');

describe('async', function () {
  it('should return the name from git config:', function (done) {
    repoName(function (err, res) {
      if (err) return done(err);
      assert(res === 'git-repo-name');
      done();
    });
  });
});

describe('sync', function () {
  it('should return the name from git config:', function () {
    assert(repoName.sync() === 'git-repo-name');
  });
});<commit_msg>Add tests for dir argument<commit_after>'use strict';

require('mocha');
var assert = require('assert');
var repoName = require('./');

describe('async', function () {
  it('should return the name from git config:', function (done) {
    repoName(function (err, res) {
      if (err) return done(err);
      assert(res === 'git-repo-name');
      done();
    });
  });
});

describe('sync', function () {
  it('should return the name from git config:', function () {
    assert(repoName.sync() === 'git-repo-name');
  });
});

describe('dir', function() {
  it('should work fine with dir argument in async mode', function(done) {
    repoName('.', function (err, res) {
      if (err) return done(err);
      assert(repoName.sync() === 'git-repo-name');
      done();
    });
  });
  
  it('should work fine with dir argument in sync mode', function() {
    assert(repoName.sync('.') === 'git-repo-name');
  });
  
  it('should return error .git folder don\'t exists', function(done) {
    repoName('docs', function (err, res) {
      assert.equal(err, 'cannot find ".git/config"');
      done();
    });
  });
});
{'fraction_non_alphanumeric': 0.2023370233702337, 'fraction_numerical': 0.0, 'mean_word_length': 3.4575342465753423, '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': '7066817', 'n_tokens_mistral': 509, 'n_tokens_neox': 501, 'n_words': 141}