Skip to content

Commit

Permalink
Simplify integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adlawson committed Nov 20, 2012
1 parent a60a670 commit 7d0841f
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions test/integration/code.coffee
Expand Up @@ -6,31 +6,37 @@
{code} = require '../../src/key'


# Test refs in a collection
#
# @param [Object] collection
# @param [Function] fn
testCollection = (collection, fn = testRef) ->
for key, ref of collection
fn key, ref


# Test a ref
#
# @param [String] name
# @param [Reference] ref
testRef = (name, ref) ->
test "#{name} is a reference", ->
assert.isTrue isRef ref


# Tests
suite 'code:', ->
suite 'alnum:', ->
for key, ref of code.alnum
do (key, ref) ->
test "#{key} is a reference", ->
assert.isTrue isRef ref
testCollection code.alnum

suite 'arrow:', ->
for key, ref of code.arrow
do (key, ref) ->
test "#{key} is a reference", ->
assert.isTrue isRef ref
testCollection code.arrow

suite 'special:', ->
for key, ref of code.special
do (key, ref) ->
test "#{key} is a reference", ->
assert.isTrue isRef ref
testCollection code.special

suite 'brand:', ->
test 'apple is a reference', ->
assert.isTrue isRef code.brand.apple
testRef 'apple', code.brand.apple

suite 'windows:', ->
for key, ref of code.brand.windows
do (key, ref) ->
test "#{key} is a reference", ->
assert.isTrue isRef ref
testCollection code.brand.windows

0 comments on commit 7d0841f

Please sign in to comment.