-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(disconnected): function to break all pending promises
- Loading branch information
1 parent
a43338d
commit 79a930a
Showing
2 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test } from 'tape-promise/tape'; | ||
import { harden, makeCapTP } from '../lib/captp'; | ||
|
||
test('try disconnecting captp', async t => { | ||
try { | ||
const { dispatch, getBootstrap, disconnected } = makeCapTP('us', obj => {}, () => harden({})); | ||
const pr = t.rejects(getBootstrap(), Error, 'rejected after disconnect'); | ||
disconnected(); | ||
await pr; | ||
} catch (e) { | ||
t.isNot(e, e, 'unexpected exception'); | ||
} finally { | ||
t.end(); | ||
} | ||
}); |