mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
style: 格式化文件以符合 Prettier 规范
This commit is contained in:
@@ -474,23 +474,27 @@ describe('UserMessageQueueService', () => {
|
||||
|
||||
const lockState = { held: false, holderId: null }
|
||||
|
||||
jest.spyOn(redis, 'acquireUserMessageLock').mockImplementation(async (accountId, requestId) => {
|
||||
if (!lockState.held) {
|
||||
lockState.held = true
|
||||
lockState.holderId = requestId
|
||||
return { acquired: true, waitMs: 0 }
|
||||
}
|
||||
return { acquired: false, waitMs: -1 }
|
||||
})
|
||||
jest
|
||||
.spyOn(redis, 'acquireUserMessageLock')
|
||||
.mockImplementation(async (accountId, requestId) => {
|
||||
if (!lockState.held) {
|
||||
lockState.held = true
|
||||
lockState.holderId = requestId
|
||||
return { acquired: true, waitMs: 0 }
|
||||
}
|
||||
return { acquired: false, waitMs: -1 }
|
||||
})
|
||||
|
||||
jest.spyOn(redis, 'releaseUserMessageLock').mockImplementation(async (accountId, requestId) => {
|
||||
if (lockState.holderId === requestId) {
|
||||
lockState.held = false
|
||||
lockState.holderId = null
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
jest
|
||||
.spyOn(redis, 'releaseUserMessageLock')
|
||||
.mockImplementation(async (accountId, requestId) => {
|
||||
if (lockState.holderId === requestId) {
|
||||
lockState.held = false
|
||||
lockState.holderId = null
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
jest.spyOn(userMessageQueueService, '_sleep').mockResolvedValue(undefined)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user