Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

resolves #5783

Adds comprehensive unit test coverage for SeqPreviewModal component, which previously had no tests. This made it difficult to add regression tests for pagination state loss when opening the modal.

Test Coverage

23 tests covering:

  • Modal behavior: Opening, closing (X button and backdrop click), accession display, loading/error states
  • Display modes: Half-screen and full-screen toggling
  • URL state preservation: Pagination, search filters, ordering, organism parameters maintained across modal open/close operations
  • Regression test for web(search): pagination state lost when individual sequence modal closed #5783: Specifically validates that pagination state is not lost when opening modal
  • Additional features: Sequence history menu, download functionality, error handling

Tests follow existing patterns from other spec files (mocking strategy, test structure, naming conventions).

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by appropriate, automated tests.
  • Any manual testing that has been done is documented (i.e. what exactly was tested?)
Original prompt

This section details on the original issue you should resolve

<issue_title>Add vitest unit tests for sequence details modal</issue_title>
<issue_description>It wasn't easy to add a unit test for #5783 because there are no existing (unit) tests at all for the sequence details modal. Copilot tried to add some but struggled with some mocking issues - so we should deal with this separately.

Some things to add in initial test beyond a regression test for #5783 (pagination lost when opening modal):

  • Modal opens
  • Shows right accession
  • Can be closed again
  • URL is back to initial state after closing

Closing can be done via: a) clicking outside of modal, b) clicking x

URL state to test for non-changing: search filter, ordering, pagination, organism</issue_description>

<agent_instructions>Add a new vitest spec test file to test specifically the preview modal - look at existing tests how they are done and stick to the patterns.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 3, 2026 09:48
- Add tests for modal opening/closing behavior
- Add tests for accession display in modal header
- Add tests for half-screen and full-screen modes
- Add tests for URL state preservation (pagination, filters, ordering, organism)
- Add tests for closing via X button and backdrop click
- Add regression test for issue #5783 (pagination preservation when opening modal)
- Add tests for sequence entry history display
- Add tests for error handling (fetch failures, JSON parsing errors)
- Add tests for loading states

All 23 tests passing successfully.

Co-authored-by: corneliusroemer <[email protected]>
- Fix import order (detailsJson before referencesGenomes)
- Remove async from mock functions that don't need await
- Remove unnecessary type assertion
- Use Promise.resolve/reject for mock json methods

Co-authored-by: corneliusroemer <[email protected]>
Copilot AI changed the title [WIP] Add vitest unit tests for sequence details modal test(website): Add vitest unit tests for sequence details modal Jan 3, 2026
Copilot AI requested a review from corneliusroemer January 3, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add vitest unit tests for sequence details modal web(search): pagination state lost when individual sequence modal closed

2 participants