compiler-setting.test.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { screen, within, render } from '@testing-library/react'
  2. import { expect } from 'chai'
  3. import fetchMock from 'fetch-mock'
  4. import { SettingsModalProvider } from '@/features/ide-redesign/contexts/settings-modal-context'
  5. import { EditorProviders } from '../../../helpers/editor-providers'
  6. import CompilerSetting from '@/features/ide-redesign/components/settings/compiler-settings/compiler-setting'
  7. describe('<CompilerSetting />', function () {
  8. afterEach(function () {
  9. fetchMock.removeRoutes().clearHistory()
  10. })
  11. it('shows correct menu', async function () {
  12. render(
  13. <EditorProviders>
  14. <SettingsModalProvider>
  15. <CompilerSetting />
  16. </SettingsModalProvider>
  17. </EditorProviders>
  18. )
  19. const select = screen.getByLabelText('Compiler')
  20. const optionPdfLaTeX = within(select).getByText('pdfLaTeX')
  21. expect(optionPdfLaTeX.getAttribute('value')).to.equal('pdflatex')
  22. const optionLaTeX = within(select).getByText('LaTeX')
  23. expect(optionLaTeX.getAttribute('value')).to.equal('latex')
  24. const optionXeLaTeX = within(select).getByText('XeLaTeX')
  25. expect(optionXeLaTeX.getAttribute('value')).to.equal('xelatex')
  26. const optionLuaLaTeX = within(select).getByText('LuaLaTeX')
  27. expect(optionLuaLaTeX.getAttribute('value')).to.equal('lualatex')
  28. })
  29. })