<commit_before>/**
 * rte <https://github.com/jonschlinkert/rte>
 *
 * Copyright (c) 2014, <NAME>, <NAME>, contributors.
 * Licensed under the MIT License
 *
 */

var expect = require('chai').expect;
var Route = require('../');
var rte = new Route();

describe('rte:', function() {
  describe('paths', function() {
    it('should replace :basename', function() {
      var structure = ':dirname/:basename.:ext';
      var expected = {
        dirname: 'foo',
        basename: 'index',
        ext: '.html'
      };
      var actual = rte.parse('foo/index.html');
      expect(actual.dir).to.eql('foo');
    });
  });

  describe('when a configuration is passed in', function () {

    var src = 'vendor/bootstrap/dist/js/bootstrap.js';

    var config = {
      flatten: false,
      prefixBase: false,
      srcBase: 'vendor/bootstrap/dist',
      destBase: '_gh_pages/public',
      ext: '.min.js',

      year: 2014,
      months: 05,
      day: 08
    };

    var route = new Route(config);
    route.set('date', ':destBase/:year/:month/:day/js/:basename:ext');


    describe('when only src is passed in', function () {
      it('should return a basic dest', function() {
        var actual = route.parse(src).dest;
        var expected = '_gh_pages/public/js/bootstrap.min.js';
        expect(actual).to.eql(expected);
      });
    });


    describe('when src with options is passed in', function () {
      it('should return a dest with the prefixBase', function() {
        var actual = route.parse(src, {prefixBase: true}).dest;
        var expected = '_gh_pages/public/vendor/bootstrap/dist/js/bootstrap.min.js';
        expect(actual).to.eql(expected);
      });
    });


    describe('when src with a specified structure key is passed in', function () {
      it('should return a dest formated based on the structure', function() {
        var actual = route.parse(src, 'date').dest;
        var expected = '_gh_pages/public/2014/05/08/js/bootstrap.min.js';
        expect(actual).to.eql(expected);
      });
    });
  });
});







<commit_msg>adds tests<commit_after>/**
 * rte <https://github.com/jonschlinkert/rte>
 *
 * Copyright (c) 2014, <NAME>, <NAME>, contributors.
 * Licensed under the MIT License
 *
 */

var expect = require('chai').expect;
var Route = require('../');
var rte = new Route();

describe('rte:', function() {
  describe('paths', function() {
    it('should replace :basename', function() {
      var structure = ':dirname/:basename.:ext';
      var expected = {
        dirname: 'foo',
        basename: 'index',
        ext: '.html'
      };
      var actual = rte.parse('foo/index.html');
      expect(actual.dir).to.eql('foo');
    });
  });

  describe('when a configuration is passed in', function () {
    var config = {
      flatten: false,
      prefixBase: false,
      srcBase: 'vendor/bootstrap/dist',
      destBase: '_gh_pages/public',
      ext: '.min.js',

      year: 2014,
      months: 05,
      day: 08
    };

    var route = new Route(config);
    var src = 'vendor/bootstrap/dist/js/bootstrap.js';
    route.set('date', ':destBase/:year/:month/:day/js/:basename:ext');


    describe('when only src is passed in', function () {
      it('should return a basic dest', function() {
        var actual = route.parse(src).dest;
        var expected = '_gh_pages/public/js/bootstrap.min.js';
        expect(actual).to.eql(expected);
      });
    });


    describe('when src with options is passed in', function () {
      it('should return a dest with the prefixBase', function() {
        var actual = route.parse(src, {prefixBase: true}).dest;
        var expected = '_gh_pages/public/vendor/bootstrap/dist/js/bootstrap.min.js';
        expect(actual).to.eql(expected);
      });
    });


    describe('when src with a specified structure key is passed in', function () {
      it('should return a dest formated based on the structure', function() {
        var actual = route.parse(src, 'date').dest;
        var expected = '_gh_pages/public/2014/05/08/js/bootstrap.min.js';
        expect(actual).to.eql(expected);
      });
    });
  });


  describe('rte.stringify()', function() {
    var rte = new Route({
      dirname: 'foo',
      basename: 'index',
      ext: '.html'
    });
    rte.set('one', ':dirname/:basename:ext');
    rte.set('two', ':dirname/foo/bar/baz/:basename:ext');

    it('should return a string using the named structure', function() {
      var actual = rte.stringify('one');
      expect(actual).to.eql('foo/index.html');
    });

    it('should return a string using the named structure', function() {
      var actual = rte.stringify('two');
      expect(actual).to.eql('foo/foo/bar/baz/index.html');
    });
  });
});








{'fraction_non_alphanumeric': 0.1687129551227773, 'fraction_numerical': 0.00846740050804403, 'mean_word_length': 2.6458333333333335, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4349545', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1441, 'n_words': 353}