import { describe, test, expect } from 'vitest'; import { render } from '@testing-library/svelte'; import Icon from '../../offline'; const iconDataWithID = { body: '', width: 128, height: 128, }; describe('Replacing IDs', () => { test('default behavior', () => { const component = render(Icon, { icon: iconDataWithID }); const node = component.container.querySelector('svg')!; // Check that default id doesn't exist const path = node.getElementById('ssvg-id-1st-place-medala'); expect(path).toBeNull(); }); test('custom generator', () => { const component = render(Icon, { icon: iconDataWithID, id: 'test' }); const node = component.container.querySelector('svg')!; // Check that ID 'testID0' exists const path = node.getElementById('testID0'); expect(path).toBeTruthy(); }); });