Skip to content

Commit 39d0c47

Browse files
Tests for invalid socket ids
1 parent 731c0c8 commit 39d0c47

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/integration/pusher/authenticate.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ describe("Pusher", function() {
9292
}).to.throwException(/^Invalid socket id: ''$/);
9393
});
9494

95+
it("should raise an exception if socket id is invalid", function() {
96+
expect(function() {
97+
pusher.authenticate("1.1:", "test")
98+
}).to.throwException(/^Invalid socket id/);
99+
expect(function() {
100+
pusher.authenticate(":1.1", "test")
101+
}).to.throwException(/^Invalid socket id/);
102+
expect(function() {
103+
pusher.authenticate(":\n1.1", "test")
104+
}).to.throwException(/^Invalid socket id/);
105+
expect(function() {
106+
pusher.authenticate("1.1\n:", "test")
107+
}).to.throwException(/^Invalid socket id/);
108+
});
109+
95110
it("should raise an exception if channel name is not a string", function() {
96111
expect(function() {
97112
pusher.authenticate("111.222", undefined)

0 commit comments

Comments
 (0)