aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/bun.js/socket/socket.test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/bun.js/socket/socket.test.ts b/test/bun.js/socket/socket.test.ts
index f9218493f..200f9528c 100644
--- a/test/bun.js/socket/socket.test.ts
+++ b/test/bun.js/socket/socket.test.ts
@@ -33,6 +33,23 @@ it("should keep process alive only when active", async () => {
]);
});
+it("listen() should throw connection error for invalid host", () => {
+ expect(() => {
+ const handlers = {
+ open(socket) {
+ socket.close();
+ },
+ data() {},
+ };
+
+ Bun.listen({
+ port: 4423,
+ hostname: "whatishtis.com",
+ socket: handlers,
+ });
+ }).toThrow();
+});
+
it("should reject on connection error, calling both connectError() and rejecting the promise", (done) => {
var data = {};
connect({