Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Added tests for recent bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pksunkara committed Apr 1, 2015
1 parent 806b7c4 commit 97759b7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/rule.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports =
# @param dataStructure [Object] The super type data structure
# @param memberTypeSection [Object] Member Type Section to be copied into
copyMembers: (dataStructure, memberTypeSection) ->
return if not dataStructure
return if not dataStructure or not memberTypeSection

for section in dataStructure.sections
if section['class'] is 'memberType'
Expand Down
46 changes: 46 additions & 0 deletions test/unit/drafter-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,49 @@ describe 'Drafter Class', ->
assert.deepEqual result.ast, require '../fixtures/dataStructures.ast.json'

done()

it 'parses correctly when super type of a member is not found', (done) ->
drafter = new Drafter

blueprint = '''
# Polls [/]
+ Attributes
+ owner (Person)
'''

drafter.make blueprint, (error, result) ->
assert.isNull error
assert.ok result.ast
done()

it 'parses correctly when super type of a type is not found', (done) ->
drafter = new Drafter

blueprint = '''
# Polls [/]
## Get a Poll [GET]
+ Attributes (Person)
+ id
'''

drafter.make blueprint, (error, result) ->
assert.isNull error
assert.ok result.ast
done()

it 'parses correctly when named type in a mixin is not found', (done) ->
drafter = new Drafter

blueprint = '''
# Polls [/]
+ Attributes
+ Include Person
'''

drafter.make blueprint, (error, result) ->
assert.isNull error
assert.ok result.ast
done()

0 comments on commit 97759b7

Please sign in to comment.