Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit f65a81e

Browse files
committed
fix after merge
1 parent 5da7f76 commit f65a81e

File tree

1 file changed

+7
-41
lines changed

1 file changed

+7
-41
lines changed

test/RealtimeChannel.test.ts

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,40 +1407,6 @@ describe('trigger', () => {
14071407
})
14081408
})
14091409

1410-
describe('worker', () => {
1411-
let client: RealtimeClient
1412-
let mockServer: Server
1413-
1414-
beforeAll(() => {
1415-
window.Worker = Worker
1416-
projectRef = randomProjectRef()
1417-
url = `wss://${projectRef}/socket`
1418-
mockServer = new Server(url)
1419-
})
1420-
1421-
afterAll(() => {
1422-
// @ts-ignore - Deliberately removing Worker to clean up test environment
1423-
window.Worker = undefined
1424-
mockServer.close()
1425-
})
1426-
1427-
beforeEach(() => {
1428-
client = new RealtimeClient('ws://localhost:8080/socket', {
1429-
worker: true,
1430-
workerUrl: 'https://realtime.supabase.com/worker.js',
1431-
heartbeatIntervalMs: 10,
1432-
})
1433-
})
1434-
1435-
test('sets worker flag', () => {
1436-
assert.ok(client.worker)
1437-
})
1438-
1439-
test('sets worker URL', () => {
1440-
assert.equal(client.workerUrl, 'https://realtime.supabase.com/worker.js')
1441-
})
1442-
})
1443-
14441410
describe('unsubscribe', () => {
14451411
let destroySpy: sinon.SinonSpy
14461412

@@ -1456,7 +1422,7 @@ describe('unsubscribe', () => {
14561422

14571423
test('cleans up leavePush on successful unsubscribe', async () => {
14581424
await channel.unsubscribe()
1459-
1425+
14601426
assert.ok(destroySpy.calledTwice) // Once for joinPush, once for leavePush
14611427
assert.equal(channel.state, CHANNEL_STATES.closed)
14621428
})
@@ -1466,9 +1432,9 @@ describe('unsubscribe', () => {
14661432
// Simulate timeout by not responding
14671433
clock.tick(defaultTimeout + 1)
14681434
})
1469-
1435+
14701436
const result = await channel.unsubscribe()
1471-
1437+
14721438
assert.ok(destroySpy.calledTwice) // Once for joinPush, once for leavePush
14731439
assert.equal(result, 'timed out')
14741440
assert.equal(channel.state, CHANNEL_STATES.closed)
@@ -1481,19 +1447,19 @@ describe('unsubscribe', () => {
14811447
// const leavePush = channel['joinPush']
14821448
// leavePush.trigger('error', {})
14831449
// })
1484-
1450+
14851451
// const result = await channel.unsubscribe()
1486-
1452+
14871453
// assert.ok(destroySpy.calledTwice) // Once for joinPush, once for leavePush
14881454
// assert.equal(result, 'error')
14891455
// assert.equal(channel.state, CHANNEL_STATES.closed)
14901456
// })
14911457

14921458
test('cleans up leavePush even if socket is not connected', async () => {
14931459
sinon.stub(socket, 'isConnected').returns(false)
1494-
1460+
14951461
await channel.unsubscribe()
1496-
1462+
14971463
assert.ok(destroySpy.calledTwice) // Once for joinPush, once for leavePush
14981464
assert.equal(channel.state, CHANNEL_STATES.closed)
14991465
})

0 commit comments

Comments
 (0)