fix(profile): stabilize binding compatibility and frontend checks
This commit is contained in:
@@ -621,6 +621,34 @@ describe('WechatCallbackView', () => {
|
||||
expect(locationState.current.href).toContain('mode=open')
|
||||
})
|
||||
|
||||
it('shows an error and stays on the page when preparing bind-token for the current account fails', async () => {
|
||||
exchangePendingOAuthCompletionMock.mockResolvedValue({
|
||||
error: 'invitation_required',
|
||||
redirect: '/usage',
|
||||
})
|
||||
getAuthTokenMock.mockReturnValue('current-auth-token')
|
||||
prepareOAuthBindAccessTokenCookieMock.mockRejectedValue(new Error('bind token failed'))
|
||||
|
||||
const wrapper = mount(WechatCallbackView, {
|
||||
global: {
|
||||
stubs: {
|
||||
AuthLayout: { template: '<div><slot /></div>' },
|
||||
Icon: true,
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
transition: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await flushPromises()
|
||||
|
||||
await wrapper.get('[data-testid="existing-account-submit"]').trigger('click').catch(() => undefined)
|
||||
await flushPromises()
|
||||
|
||||
expect(showErrorMock).toHaveBeenCalledWith('bind token failed')
|
||||
expect(locationState.current.href).toBe('http://localhost/auth/wechat/callback')
|
||||
})
|
||||
|
||||
it('collects email, password, and verify code for pending oauth account creation and submits adoption decisions', async () => {
|
||||
getPublicSettingsMock.mockResolvedValue({
|
||||
invitation_code_enabled: true,
|
||||
|
||||
Reference in New Issue
Block a user