import{addClassIfElementExists}from'~/lib/utils/dom_utils';describe('DOM Utils',()=>{describe('addClassIfElementExists',()=>{constclassName='biology';constfixture=` <div class="parent"> <div class="child"></div> </div> `;letparentElement;beforeEach(()=>{setFixtures(fixture);parentElement=document.querySelector('.parent');});it('adds class if element exists',()=>{constchildElement=parentElement.querySelector('.child');expect(childElement).not.toBe(null);addClassIfElementExists(childElement,className);expect(childElement.classList).toContain(className);});it('does not throw if element does not exist',()=>{constchildElement=parentElement.querySelector('.other-child');expect(childElement).toBe(null);addClassIfElementExists(childElement,className);});});});