mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-21 21:47:00 +08:00
feat: 完成 UI 基础层与核心页面迁移
This commit is contained in:
@@ -132,4 +132,26 @@ describe('useExternalProviderConsent', () => {
|
||||
expect(resolved).toHaveBeenCalledOnce()
|
||||
expect(resolved).toHaveBeenCalledWith(true)
|
||||
})
|
||||
|
||||
it.each([true, false])(
|
||||
'settles the previous pending request when a new request replaces it, then resolves %s',
|
||||
async (secondDecision) => {
|
||||
const { result } = renderHook(() => useExternalProviderConsent())
|
||||
let first!: Promise<boolean>
|
||||
let second!: Promise<boolean>
|
||||
act(() => {
|
||||
first = result.current.requestExternalProviderConsent('First', 'first-recipient')
|
||||
second = result.current.requestExternalProviderConsent('Second', 'second-recipient')
|
||||
})
|
||||
|
||||
await expect(first).resolves.toBe(false)
|
||||
expect(result.current.externalProviderConsent).toEqual({
|
||||
providerName: 'Second',
|
||||
recipient: 'second-recipient'
|
||||
})
|
||||
|
||||
act(() => result.current.settleExternalProviderConsent(secondDecision))
|
||||
await expect(second).resolves.toBe(secondDecision)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user