Skip to content

armgit / dify

Public Imported from GitHub
0

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.

1.3 KB
Raw Blame
import { screen } from '@testing-library/react'
import { createConsoleQueryWrapper, seedFeatures } from '@/test/console/query-data'
import { render } from '@/test/console/render'
import EducationApplyRoute from '../application-entry'

const mockRedirect = vi.hoisted(() => vi.fn(() => null as never))

vi.mock('@/next/navigation', () => ({
  redirect: mockRedirect,
}))

vi.mock('../application-form', () => ({
  default: ({ token }: { token: string }) => <div>Application form: {token}</div>,
}))

describe('EducationApplyRoute', () => {
  it('returns to home when the education plan is unavailable', () => {
    const { queryClient, wrapper } = createConsoleQueryWrapper()
    seedFeatures(queryClient, { education: { enabled: false } })

    render(<EducationApplyRoute token="education-token" />, { wrapper })

    expect(mockRedirect).toHaveBeenCalledWith('/')
  })

  it('renders the application form for a direct token URL', () => {
    const { queryClient, wrapper } = createConsoleQueryWrapper({
      educationStatus: { is_student: false },
    })
    seedFeatures(queryClient, {
      billing: { subscription: { plan: 'sandbox' } },
      education: { enabled: true },
    })

    render(<EducationApplyRoute token="education-token" />, { wrapper })

    expect(screen.getByText('Application form: education-token')).toBeInTheDocument()
  })
})