Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
import { screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { consoleClient } from '@/service/console'
import { renderWithAccountProfile } from '@/test/console/account-profile'
import { useAccountDeleteStore } from '../../state'
import CheckEmail from '../check-email'
vi.mock('@/service/console', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/service/console')>()
const { withConsoleClientResponses } = await import('@/test/console/service-responses')
return {
...actual,
consoleClient: withConsoleClientResponses(actual.consoleClient, {
'account.delete.verify.get': vi.fn(),
}),
}
})
describe('CheckEmail', () => {
beforeEach(() => {
vi.mocked(consoleClient.account.delete.verify.get).mockResolvedValue({
result: 'success',
data: 'deletion-email-token',
})
})
it('requests and stores a verification token only after the account email matches', async () => {
const user = userEvent.setup()
const onConfirm = vi.fn()
renderWithAccountProfile(<CheckEmail onCancel={vi.fn()} onConfirm={onConfirm} />, {
accountProfile: { email: '[email protected]' },
})
const input = screen.getByRole('textbox', { name: 'accountSettings.account.deleteLabel' })
const submitButton = screen.getByRole('button', {
name: 'accountSettings.account.sendVerificationButton',
})
await user.type(input, '[email protected]{Enter}')
expect(submitButton).toBeDisabled()
expect(consoleClient.account.delete.verify.get).not.toHaveBeenCalled()
await user.clear(input)
await user.type(input, '[email protected]{Enter}')
await waitFor(() => {
expect(useAccountDeleteStore.getState().sendEmailToken).toBe('deletion-email-token')
})
expect(submitButton).toBeEnabled()
expect(consoleClient.account.delete.verify.get).toHaveBeenCalledExactlyOnceWith()
expect(onConfirm).toHaveBeenCalledOnce()
})
})