fix(frontend): preserve callback recovery state
This commit is contained in:
@@ -409,6 +409,50 @@ describe('LinuxDoCallbackView', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps the oauth flow active when complete-registration returns another pending step', async () => {
|
||||
exchangePendingOAuthCompletion.mockResolvedValue({
|
||||
error: 'invitation_required',
|
||||
redirect: '/dashboard',
|
||||
adoption_required: true,
|
||||
suggested_display_name: 'LinuxDo Nick',
|
||||
suggested_avatar_url: 'https://cdn.example/linuxdo.png'
|
||||
})
|
||||
completeLinuxDoOAuthRegistration.mockResolvedValue({
|
||||
auth_result: 'pending_session',
|
||||
step: 'choose_account_action_required',
|
||||
redirect: '/dashboard',
|
||||
email: 'fresh@example.com',
|
||||
resolved_email: 'fresh@example.com',
|
||||
force_email_on_signup: true,
|
||||
adoption_required: true
|
||||
})
|
||||
|
||||
const wrapper = mount(LinuxDoCallbackView, {
|
||||
global: {
|
||||
stubs: {
|
||||
AuthLayout: { template: '<div><slot /></div>' },
|
||||
Icon: true,
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
transition: false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
await flushPromises()
|
||||
await wrapper.find('input[type="text"]').setValue('invite-code')
|
||||
await wrapper.find('button').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(completeLinuxDoOAuthRegistration).toHaveBeenCalledWith('invite-code', {
|
||||
adoptDisplayName: true,
|
||||
adoptAvatar: true
|
||||
})
|
||||
expect(setToken).not.toHaveBeenCalled()
|
||||
expect(replace).not.toHaveBeenCalled()
|
||||
expect(wrapper.text()).toContain('auth.oauthFlow.bindExistingAccount')
|
||||
expect(wrapper.text()).toContain('auth.oauthFlow.createNewAccount')
|
||||
})
|
||||
|
||||
it('collects email, password, and verify code for pending oauth account creation and submits adoption decisions', async () => {
|
||||
getPublicSettings.mockResolvedValue({
|
||||
invitation_code_enabled: true,
|
||||
|
||||
Reference in New Issue
Block a user