Skip to content

Commit

Permalink
add test for non existing subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
mstdokumaci committed Jan 2, 2019
1 parent 51c0a97 commit 2e88271
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/network/subscriptions/corner-cases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const test = require('tape')
const { create } = require('../../../dist')

test('network - subscriptions - corner cases', t => {
const sMaster = create({
existing: 'value'
})

const server = sMaster.listen(7070)

const cMaster = create()

cMaster.get('non-existing', {}).subscribe(
ne => {
if (ne.compute()) {
t.fail('should not fire for non existing')
}
}
)
cMaster.get('existing', {}).subscribe(
existing => {
if (existing.compute()) {
t.equals(
existing.compute(),
'value',
'existing.compute() === value'
)
client.socket.close()
server.close()
t.end()
}
}
)

const client = cMaster.connect('ws://localhost:7070')
})
1 change: 1 addition & 0 deletions test/network/subscriptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ require('./simple')
require('./data-size')
require('./remove')
require('./routing')
require('./corner-cases')

0 comments on commit 2e88271

Please sign in to comment.