ObicoSettings.test.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * The Obico status panel shows the pause level next to Low / High (#3459):
  3. * pausing waits for Obico's pause level (High x 1.75), so a score above High
  4. * alone is a warning.
  5. */
  6. import { describe, it, expect, vi } from 'vitest';
  7. import { screen } from '@testing-library/react';
  8. import { render } from '../utils';
  9. import { ObicoSettings } from '../../components/ObicoSettings';
  10. vi.mock('../../api/client', () => ({
  11. api: {
  12. getSettings: vi.fn().mockResolvedValue({ obico_enabled: true, obico_ml_url: 'http://obico:3333' }),
  13. getPrinters: vi.fn().mockResolvedValue([]),
  14. getObicoStatus: vi.fn().mockResolvedValue({
  15. is_running: true,
  16. last_error: null,
  17. per_printer: {},
  18. thresholds: { low: 0.38, high: 0.78, pause: 1.4 },
  19. history: [],
  20. }),
  21. },
  22. }));
  23. describe('ObicoSettings status panel', () => {
  24. it('shows the pause level', async () => {
  25. render(<ObicoSettings />);
  26. expect(await screen.findByText('0.38 / 0.78')).toBeInTheDocument();
  27. expect(screen.getByText('1.40')).toBeInTheDocument();
  28. });
  29. });