import { mount } from '@vue/test-utils' import { describe, expect, it } from 'vitest' import InstrumentStateBadge from '../../components/InstrumentStateBadge.vue' describe('InstrumentStateBadge', () => { it('should render a status dot when the state does not pulse', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'idle' } }) expect(wrapper.find('.mint-instrument-state__dot').exists()).toBe(true) }) it('should label known states in sentence case when no label is given', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'disconnected' } }) expect(wrapper.text()).toBe('Offline') }) it('should pulse the dot when the instrument is running', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'RUNNING' } }) expect(wrapper.classes()).toContain('mint-instrument-state--pulse') }) it('should use the info tone when the instrument is running', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'running' } }) expect(wrapper.classes()).toContain('mint-instrument-state--info') }) it('should use the success tone when the instrument is connected', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'connected' } }) expect(wrapper.classes()).toContain('mint-instrument-state--success') }) it('should use the dash shape when the instrument never reported', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'never' } }) expect(wrapper.classes()).toContain('mint-instrument-state--never') }) it('should label the never state as never reported', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'never' } }) expect(wrapper.text()).toBe('Never reported') }) it('should use the square shape when the instrument is inactive', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'inactive' } }) expect(wrapper.classes()).toContain('mint-instrument-state--inactive') }) it('should label the inactive state as inactive', () => { const wrapper = mount(InstrumentStateBadge, { props: { state: 'inactive' } }) expect(wrapper.text()).toBe('Inactive') }) })