-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for non existing subscription
- Loading branch information
1 parent
51c0a97
commit 2e88271
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ require('./simple') | |
require('./data-size') | ||
require('./remove') | ||
require('./routing') | ||
require('./corner-cases') |