<commit_before>{assert, expect} = require 'chai'

Tree = require '../src/tree'


describe 'Tree', ->
  it 'should be an object', ->
    expect(new Tree).to.be.an('object')

  tree = new Tree

  beforeEach 'clear the tree', -> tree.clear()

  describe '#insert', ->
    it 'adds entries with valid props', ->
      tree.insert 'foo'
      expect(tree.children().foo.isFile()).to.be.true

    it 'adds entry in tree', ->
      tree.insert 'foo/index.html'
      expect(tree.children().foo.children()['index.html'].isFile()).to.be.true

    it 'appends entries together', ->
      tree.insert 'foo/bar.html'
      tree.insert 'baz.html'
      expect(tree.children().foo.isDir()).to.be.true
      expect(tree.children()['baz.html'].isFile()).to.be.true

    it 'can add any value to files', -><commit_msg>tests cover assignment<commit_after>{assert, expect} = require 'chai'

Tree = require '../src/tree'


describe 'Tree', ->
  it 'should be an object', ->
    expect(new Tree).to.be.an('object')

  tree = new Tree

  beforeEach 'clear the tree', -> tree.clear()

  describe '#insert', ->
    it 'adds entries with valid props', ->
      tree.insert 'foo'
      expect(tree.children().foo.isFile()).to.be.true

    it 'adds entry in tree', ->
      tree.insert 'foo/index.html'
      expect(tree.children().foo.children()['index.html'].isFile()).to.be.true

    it 'adds entry with props in tree', ->
      tree.insert 'foo/bar', 'banana!'
      expect(tree.children().foo.children().bar.content()).to.equal('banana!')

    it 'appends entries together', ->
      tree.insert 'foo/bar.html'
      tree.insert 'baz.html'
      expect(tree.children().foo.isDir()).to.be.true
      expect(tree.children()['baz.html'].isFile()).to.be.true

    it 'can add any value to files', ->
{'fraction_non_alphanumeric': 0.1844331641285956, 'fraction_numerical': 0.0, 'mean_word_length': 2.907488986784141, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '2228712', 'n_tokens_mistral': 587, 'n_tokens_neox': 565, 'n_words': 133}