/** * Tests for the FilamentOverride component. * * FilamentOverride allows users to override the 3MF's original filament * choices with filaments available across printers of the selected model. */ import { describe, it, expect, vi, afterEach } from 'vitest'; import { screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react'; import { http, HttpResponse } from 'msw'; import { render } from '../utils'; import { server } from '../mocks/server'; import { FilamentOverride } from '../../components/PrintModal/FilamentOverride'; import type { FilamentReqsData } from '../../components/PrintModal/types'; const defaultFilamentReqs: FilamentReqsData = { filaments: [ { slot_id: 1, type: 'PLA', color: '#FF0000', used_grams: 25, used_meters: 8.5 }, ], }; const defaultAvailable = [ { type: 'PLA', color: '#FF0000', tray_info_idx: 'GFA00', tray_sub_brands: 'PLA Basic', extruder_id: null }, { type: 'PLA', color: '#00FF00', tray_info_idx: 'GFA01', tray_sub_brands: 'PLA Basic', extruder_id: null }, { type: 'PETG', color: '#0000FF', tray_info_idx: 'GFG00', tray_sub_brands: 'PETG Basic', extruder_id: null }, ]; const mockOnChange = vi.fn(); /** * Open an override picker and hand back its rows. * * These assertions used to read `select.querySelectorAll('option')`. The * control gained a swatch per choice (#3159), which an `