<commit_before><commit_msg>Added tests.<commit_after>chai = require 'chai'
expect = chai.expect

CopyMachine = require "../index"

describe 'copy', ->
    it 'makes a deep copy of any object', (done) ->
        objectToCopy = { someString: "Certainly a string.", horse: true, potion: 1 }
        newObject = CopyMachine.copy(objectToCopy)
        
        expect(newObject).to.deep.equal(objectToCopy)
        done()
        
    it 'explodes when passed something that is not an object', (done) ->
        numbertoCopy = 20
        expect(CopyMachine.copy).to.throw(Error, 'Item to copy must be an object.')
        done()
        
    it 'passes back a new object that has no reference to the old object', (done) ->
        objectToCopy = { someString: "Certainly a string.", horse: true, potion: 1 }
        newObject = CopyMachine.copy(objectToCopy)
        
        newObject.horse = false
        expect(newObject.horse).to.not.equal(objectToCopy.horse)
        done()
{'fraction_non_alphanumeric': 0.11293634496919917, 'fraction_numerical': 0.004106776180698152, 'mean_word_length': 2.5583941605839415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7018102', 'n_tokens_mistral': 293, 'n_tokens_neox': 279, 'n_words': 85}