Permalink
Browse files

Add spec for enumerated value port

  • Loading branch information...
1 parent 4fb80b2 commit ee34609c3d9c358b9d2fcc0a3f08184e6cf27c3c Kenneth Kan committed Mar 2, 2014
Showing with 21 additions and 0 deletions.
  1. +21 −0 spec/InPort.coffee
View
@@ -129,3 +129,24 @@ describe 'Inport Port', ->
chai.expect(data).toEqual 'data'
chai.expect(data).toEqual _data
s.send 'data'
+
+ describe 'with accepted enumerated values', (done) ->
+ it 'should accept certain values', ->
+ p = new inport
+ values: 'noflo is awesome'.split ''
+ s = new socket
+ p.attach s
+ p.on 'data', (data) ->
+ chai.expect(data).toEqual 'noflo is awesome'
+ done()
+ s.send 'awesome'
+
+ it 'should send to error port if value is not accepted', ->
+ p = new inport
+ values: 'noflo is awesome'.split ''
+ s = new socket
+ p.attach s
+ cb = jasmine.createSpy()
+ p.on 'data', cb
+ s.send 'terrific'
+ chai.expect(cb).not.toHaveBeenCalled()

0 comments on commit ee34609

Please sign in to comment.