Skip to content

Commit

Permalink
chore (Module) Export function that either creates a RelationResolver…
Browse files Browse the repository at this point in the history
… or defines an angular RelationResolverModule
  • Loading branch information
Eevert Saukkokoski committed Sep 22, 2015
1 parent b94c7e7 commit 60c832c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
module.exports = {}

module.exports = (angular) ->

if angular?
require('./RelationResolverModule')(angular)
else
RelationResolver = require('./RelationResolver')
new RelationResolver
13 changes: 12 additions & 1 deletion test/SmokeTestSpec.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
require('chai').should()

createRelationResolver = require('../src')

describe "ag-relation-resolver root", ->
it "should be defined", ->
require('../src').should.exist
createRelationResolver.should.exist

it "is a function", ->
createRelationResolver.should.be.a 'function'

it 'creates a relation resolver when called without arguments', ->
createRelationResolver().should.have.property('prepare').be.a 'function'

it.skip 'creates an angular module and returns the module name when called with angular as an argument', ->
createRelationResolver(angular).should.be.a 'string'

0 comments on commit 60c832c

Please sign in to comment.