<commit_before>should   = require 'should'
fixtures = require './fixtures'
git      = require '../src'
Blob     = require '../src/blob'

describe "Blob", ->
  describe "constructor", ->
    repo = fixtures.branched
    blob = new Blob repo, {name: "X", mode: "Y", id: "abc"}
    it "assigns @name", ->
      blob.name.should.eql "X"
    it "assigns @mode", ->
      blob.mode.should.eql "Y"
    it "assigns @id", ->
      blob.id.should.eql "abc"
  
  
  describe "#data", ->
    describe "of a file off the root", ->
      repo = git "#{__dirname}/fixtures/branched"
      data = null
      before (done) ->
        repo.tree().blobs (err, blobs) ->
          blobs[0].data (err, _data) ->
            data = _data
            done err
      
      it "is a string", ->
        data.should.be.a "string"
        data.should.include "Bla"
    
    describe "of a file in a subdir", ->
      repo = git "#{__dirname}/fixtures/branched"
      data = null
      before (done) ->
        repo.tree().trees (err, trees) ->
          trees[0].blobs (err, blobs) ->
            blobs[0].data (err, _data) ->
              data = _data
              done err
      
      it "is a string", ->
        data.should.be.a "string"
        data.should.include "!!!"
<commit_msg>Test fix: corrected use of should to assert typeof<commit_after>should   = require 'should'
fixtures = require './fixtures'
git      = require '../src'
Blob     = require '../src/blob'

describe "Blob", ->
  describe "constructor", ->
    repo = fixtures.branched
    blob = new Blob repo, {name: "X", mode: "Y", id: "abc"}
    it "assigns @name", ->
      blob.name.should.eql "X"
    it "assigns @mode", ->
      blob.mode.should.eql "Y"
    it "assigns @id", ->
      blob.id.should.eql "abc"


  describe "#data", ->
    describe "of a file off the root", ->
      repo = git "#{__dirname}/fixtures/branched"
      data = null
      before (done) ->
        repo.tree().blobs (err, blobs) ->
          blobs[0].data (err, _data) ->
            data = _data
            done err

      it "is a string", ->
        data.should.be.type "string"
        data.should.include "Bla"

    describe "of a file in a subdir", ->
      repo = git "#{__dirname}/fixtures/branched"
      data = null
      before (done) ->
        repo.tree().trees (err, trees) ->
          trees[0].blobs (err, blobs) ->
            blobs[0].data (err, _data) ->
              data = _data
              done err

      it "is a string", ->
        data.should.be.type "string"
        data.should.include "!!!"

{'fraction_non_alphanumeric': 0.15785350567959264, 'fraction_numerical': 0.0023501762632197414, 'mean_word_length': 1.779107725788901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '6574218', 'n_tokens_mistral': 843, 'n_tokens_neox': 831, 'n_words': 230}