Skip to content

Commit 7212883

Browse files
committed
Lint
1 parent f11c940 commit 7212883

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

test/test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test('can unsubscribe from a queue', async () => {
9898
const conn = await amqp.connect()
9999
const ch = await conn.channel()
100100
const q = await ch.queue("")
101-
const consumer = await q.subscribe({}, () => "")
101+
const consumer = await q.subscribe({}, () => {})
102102
await expect(q.unsubscribe(consumer.tag)).resolves.toBeDefined()
103103
})
104104

@@ -132,7 +132,7 @@ test('will throw an error after consumer timeout', async () => {
132132
const conn = await amqp.connect()
133133
const ch = await conn.channel()
134134
const q = await ch.queue("")
135-
const consumer = await q.subscribe({ noAck: false }, () => "")
135+
const consumer = await q.subscribe({ noAck: false }, () => {})
136136
await expect(consumer.wait(1)).rejects.toThrow()
137137
})
138138

@@ -141,7 +141,7 @@ test('will throw an error if consumer is closed', async () => {
141141
const conn = await amqp.connect()
142142
const ch = await conn.channel()
143143
const q = await ch.queue("")
144-
const consumer = await q.subscribe({ noAck: false }, () => "")
144+
const consumer = await q.subscribe({ noAck: false }, () => {})
145145
consumer.setClosed(new Error("testing"))
146146
try {
147147
await consumer.wait(1);
@@ -165,7 +165,7 @@ test('will clear consumer wait timeout on cancel', async () => {
165165
const conn = await amqp.connect()
166166
const ch = await conn.channel()
167167
const q = await ch.queue("")
168-
const consumer = await q.subscribe({ noAck: false }, () => "")
168+
const consumer = await q.subscribe({ noAck: false }, () => {})
169169
const wait = consumer.wait(5000);
170170
consumer.cancel()
171171
await expect(wait).resolves.toBeUndefined()
@@ -192,7 +192,7 @@ test('consumer stops wait on cancel', async () => {
192192
const conn = await amqp.connect()
193193
const ch = await conn.channel()
194194
const q = await ch.queue()
195-
const consumer = await q.subscribe({}, () => ({}))
195+
const consumer = await q.subscribe({}, () => {})
196196
await q.publish("foobar")
197197
await consumer.cancel()
198198
await expect(consumer.wait()).resolves.toBeUndefined()
@@ -203,7 +203,7 @@ test('consumer stops wait on channel error', async () => {
203203
const conn = await amqp.connect()
204204
const ch = await conn.channel()
205205
const q = await ch.queue()
206-
const consumer = await q.subscribe({}, () => ({}))
206+
const consumer = await q.subscribe({}, () => {})
207207
// acking invalid delivery tag should close channel
208208
setTimeout(() => ch.basicAck(99999), 1)
209209
await expect(consumer.wait()).rejects.toThrow()
@@ -580,7 +580,7 @@ test("can handle cancel from server", async () => {
580580
const conn = await amqp.connect()
581581
const ch = await conn.channel()
582582
const q = await ch.queue("")
583-
const consumer = await q.subscribe({}, () => "")
583+
const consumer = await q.subscribe({}, () => {})
584584
await q.delete()
585585
await expect(consumer.wait()).rejects.toThrow(/Consumer cancelled by the server/)
586586
})
@@ -701,30 +701,30 @@ test('should fail to connect to HTTP', async () => {
701701
test('should handle heartbeat timeout correctly', async () => {
702702
const amqp = getNewClient({ heartbeat: 1 })
703703
const conn = await amqp.connect()
704-
704+
705705
// Mock the socket timeout to simulate missed heartbeats
706706
const socket = amqp["socket"]
707707
assert(socket, "Socket must be created")
708-
708+
709709
// Set up error callback to capture timeout error
710710
const errorPromise = new Promise<AMQPError>((resolve) => {
711711
conn.onerror = (err: AMQPError) => {
712712
resolve(err)
713713
}
714714
})
715-
715+
716716
// Set up close promise to detect when socket is closed
717717
const closePromise = new Promise((resolve) => {
718718
socket.on('close', resolve)
719719
})
720-
720+
721721
// Trigger timeout event to simulate heartbeat timeout
722722
socket.emit('timeout')
723-
723+
724724
// Wait for error callback and socket close
725725
const error = await errorPromise
726726
await closePromise
727-
727+
728728
// Verify error message and that connection is closed
729729
expect(error.message).toEqual('Heartbeat timeout')
730730
expect(conn.closed).toBe(true)

0 commit comments

Comments
 (0)