-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zetxx
committed
Jul 26, 2021
1 parent
9f7f987
commit c335c21
Showing
3 changed files
with
61 additions
and
20 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
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
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 |
---|---|---|
@@ -1,10 +1,32 @@ | ||
const tap = require('tap'); | ||
const bridge = require('../../../lib/bridge'); | ||
const Bridge = require('../../../lib/bridge'); | ||
|
||
tap.test('Bridge', (l1) => { | ||
l1.test('1', (t) => { | ||
tap.test('Bridge', (l0) => { | ||
// l0.test('Simple checks and coverage', (t) => { | ||
// const bridge = new Bridge(); | ||
// bridge.start({}); | ||
// bridge.destroy(); | ||
// t.end(); | ||
// }); | ||
|
||
l0.test('Method call positive cases', (t) => { | ||
// set up | ||
const bridgeA = new Bridge({config: {id: 'bridgeA'}}); | ||
const bridgeB = new Bridge({config: {id: 'bridgeB'}}); | ||
bridgeA.start({other: bridgeB}); | ||
bridgeB.start({other: bridgeA}); | ||
// register methods | ||
bridgeA.methods.add({method: 'a.in', fn: ({payload}) => { | ||
return payload; | ||
}}); | ||
bridgeB.methods.add({method: 'a.out', fn: ({payload}) => { | ||
return payload; | ||
}}); | ||
|
||
bridgeA.pass({direction: 'in', packet: {meta: {method: 'a'}, payload: {a: 1}}}); | ||
t.end(); | ||
}); | ||
l1.end(); | ||
|
||
l0.end(); | ||
}); | ||
|