Skip to content

Commit

Permalink
Add initial tests for dependency loader
Browse files Browse the repository at this point in the history
  • Loading branch information
ranweiler committed Jul 1, 2013
1 parent 62470c7 commit cd52e23
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/dependency.coffee
@@ -0,0 +1,31 @@
should = require 'should'
{join} = require 'path'

# lib stuff
{load, process, applyPolicy, print, create, print} = require '../lib/main'

# sample stuff
jargon = require '../sample/app/domain/auth/jargon'
serviceLocation = join __dirname, '../sample/app/domain/auth/services'
policy = require '../sample/app/domain/auth/policy'


describe 'dependency', ->
beforeEach (done) ->
@services = create serviceLocation, jargon, policy
@sessionId = 'ab23ab23ab23ab23'
should.exist @services.doSomething
should.exist @services.helpDoSomething
done()

it 'should fail without a dependency load function wired up', (done) ->
@services.doSomething {@sessionId}, (err) =>
should.exist err
err.message.should.equal 'Could not load dependency'
done()

it 'should not fail when the dependency load function is specified', (done) ->
# specify loader, then...
@services.doSomething {@sessionId}, (err) =>
should.not.exist err
done()

0 comments on commit cd52e23

Please sign in to comment.