Added more unit tests to increase code coverage

This commit is contained in:
Alex Janousek
2025-10-27 15:00:52 -04:00
parent 6c3a516aa6
commit c273d5dd6f
9 changed files with 446 additions and 1 deletions

View File

@@ -184,4 +184,15 @@ describe('announceUploadStatusFromElement', () => {
// Still unchanged
expect(srRegion.textContent).toBe('Old message');
});
test('does nothing if upload-status-live element does not exist', () => {
document.body.innerHTML = `
<span id="upload-error" class="usa-sr-only">File upload failed</span>
`;
expect(() => {
announceUploadStatusFromElement();
jest.advanceTimersByTime(300);
}).not.toThrow();
});
});