Skip to content

Commit

Permalink
Added test for supporting multiple connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronius committed Oct 25, 2017
1 parent c9c5223 commit 3e61c23
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,28 @@ describe('Penpal', () => {
});
});

// Had trouble implementing this one.
// it('should prevent method replies from being sent', () => {
// });
it('should support multiple connections', (done) => {
const connection1 = Penpal.connectToChild({
url: `${CHILD_SERVER}/child.html`
});
const connection2 = Penpal.connectToChild({
url: `${CHILD_SERVER}/child.html`
});

RSVP.all([
connection1.promise.then((child) => {
return child.multiplyAsync(2, 5).then((value) => {
expect(value).toEqual(10);
connection1.destroy();
});
}),
connection2.promise.then((child) => {
return child.multiplyAsync(3, 5).then((value) => {
expect(value).toEqual(15);
connection2.destroy();
});
})
]).then(done);
})
});
});

0 comments on commit 3e61c23

Please sign in to comment.