<commit_before>Snockets = require '../lib/snockets'
path     = require 'path'
src      = 'spec/assets'

# Jasmine.Async, v0.1.0
# Copyright (c)2012 Muted Solutions, LLC. All Rights Reserved.
# Distributed under MIT license
# http://github.com/derickbailey/jasmine.async
runAsync = (block) ->
	->
		done = false
		complete = ->
			done = true

		runs ->
			block complete

		waitsFor ->
			done

class AsyncSpec
	constructor: (@spec) ->

	beforeEach: (block) ->
		@spec.beforeEach runAsync(block)

	afterEach: (block) ->
		@spec.afterEach runAsync(block)

	it: (description, block) ->
		global.it description, runAsync(block)


describe 'Snockets Legacy API', ->

	snockets = null
	async = new AsyncSpec(@)

	beforeEach ->
		snockets = new Snockets { src }

	afterEach ->
		snockets = null

	async.it 'doesn\'t find dependencies for independant js files', (done) ->

		snockets.scan 'b.js', (err) ->
			throw err if err
			expect(snockets.depGraph.map['b.js']).toBeDefined()
			expect(snockets.depGraph.getChain 'b.js').toEqual []
			done()

<commit_msg>two tests converted, that's pretty easy. :-)<commit_after>Snockets = require '../lib/snockets'
path     = require 'path'
src      = 'spec/assets'

# Jasmine.Async, v0.1.0
# Copyright (c)2012 Muted Solutions, LLC. All Rights Reserved.
# Distributed under MIT license
# http://github.com/derickbailey/jasmine.async
runAsync = (block) ->
    ->
        done = false
        complete = ->
            done = true

        runs ->
            block complete

        waitsFor ->
            done

class AsyncSpec
    constructor: (@spec) ->

    beforeEach: (block) ->
        @spec.beforeEach runAsync(block)

    afterEach: (block) ->
        @spec.afterEach runAsync(block)

    it: (description, block) ->
        global.it description, runAsync(block)


describe 'Snockets Legacy API', ->

    snockets = null
    async = new AsyncSpec(@)

    beforeEach ->
        snockets = new Snockets { src }

    afterEach ->
        snockets = null

    describe 'doesn\'t find dependencies for independant js files', ->
        async.it 'async', (done) ->
            snockets.scan 'b.js', (err) ->
                throw err if err
                expect(snockets.depGraph.map['b.js']).toBeDefined()
                expect(snockets.depGraph.getChain 'b.js').toEqual []
                done()

        it 'sync', ->
            snockets.options.async = false
            snockets.scan 'b.js', ->
            expect(snockets.depGraph.map['b.js']).toBeDefined()
            expect(snockets.depGraph.getChain 'b.js').toEqual []

    describe 'Single-step dependencies are correctly recorded', ->
        async.it 'async', (done) ->
            snockets.scan 'a.coffee', (err) ->
                throw err if err
                expect(snockets.depGraph.getChain('a.coffee')).toEqual ['b.js']
                done()

        it 'sync', ->
            snockets.options.async = false
            snockets.scan 'a.coffee', ->
            expect(snockets.depGraph.getChain('a.coffee')).toEqual ['b.js']

    xdescribe '', ->
        async.it 'async', (done) ->

        it 'sync', ->
            snockets.options.async = false


{'fraction_non_alphanumeric': 0.1374841972187105, 'fraction_numerical': 0.004424778761061947, 'mean_word_length': 2.2034412955465585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 42, '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': '5181679', 'n_tokens_mistral': 1031, 'n_tokens_neox': 955, 'n_words': 232}