mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
fix: test
This commit is contained in:
parent
70a19f668c
commit
e3134647a3
@ -54,8 +54,7 @@ describe('LanTransferClientService', () => {
|
||||
|
||||
await expect(
|
||||
lanTransferClientService.connectAndHandshake({
|
||||
peerId: 'non-existent',
|
||||
type: 'connect'
|
||||
peerId: 'non-existent'
|
||||
})
|
||||
).rejects.toThrow('Selected LAN peer is no longer available')
|
||||
})
|
||||
@ -72,8 +71,7 @@ describe('LanTransferClientService', () => {
|
||||
|
||||
await expect(
|
||||
lanTransferClientService.connectAndHandshake({
|
||||
peerId: 'test-peer',
|
||||
type: 'connect'
|
||||
peerId: 'test-peer'
|
||||
})
|
||||
).rejects.toThrow('Selected peer does not expose a TCP port')
|
||||
})
|
||||
@ -91,8 +89,7 @@ describe('LanTransferClientService', () => {
|
||||
|
||||
await expect(
|
||||
lanTransferClientService.connectAndHandshake({
|
||||
peerId: 'test-peer',
|
||||
type: 'connect'
|
||||
peerId: 'test-peer'
|
||||
})
|
||||
).rejects.toThrow('Unable to resolve a reachable host for the peer')
|
||||
})
|
||||
|
||||
@ -83,13 +83,13 @@ describe('binaryProtocol', () => {
|
||||
})
|
||||
|
||||
it('should throw error when socket is not writable', () => {
|
||||
mockSocket.writable = false
|
||||
;(mockSocket as any).writable = false
|
||||
|
||||
expect(() => sendBinaryChunk(mockSocket, 'test-id', 0, Buffer.from('data'))).toThrow('Socket is not writable')
|
||||
})
|
||||
|
||||
it('should throw error when socket is destroyed', () => {
|
||||
mockSocket.destroyed = true
|
||||
;(mockSocket as any).destroyed = true
|
||||
|
||||
expect(() => sendBinaryChunk(mockSocket, 'test-id', 0, Buffer.from('data'))).toThrow('Socket is not writable')
|
||||
})
|
||||
|
||||
@ -194,7 +194,7 @@ describe('connection handlers', () => {
|
||||
})
|
||||
|
||||
it('should throw error when socket is destroyed', async () => {
|
||||
mockSocket.destroyed = true
|
||||
;(mockSocket as any).destroyed = true
|
||||
const abortController = new AbortController()
|
||||
|
||||
await expect(waitForSocketDrain(mockSocket, abortController.signal)).rejects.toThrow('Socket is closed')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user