Skip to content

Conversation

@vekkele
Copy link
Contributor

@vekkele vekkele commented Aug 7, 2025

Summary

Added integration tests for Alerts creation.
Currently, the following types of tests are included:

  • UI tests:
    Render the dialog component with a given alert prop and verify that:
    • The correct category is selected and the Back button is not rendered
    • The Submit button has the correct disabled state (validity check)
  • API tests:
    Call mutateSaveAlert (and mutateDeleteAlert afterward for cleanup) with the same alert shape as in the UI tests, verifying that the backend successfully accepts it.

There are some considerations/proposals about testing:

@DmitriVanGuard @serafim-san Feel free to comment here your thoughts about it if you have any

In my opinion, it’s better to minimize direct calls to the real API in tests.
Here’s a proposal for replacing integration tests with more focused unit tests, while still ensuring backend compatibility:

  • UI tests: keep as they are
  • Transformation tests (apiAlert → internal state):
    • Cover edge cases for legacy alerts (created with a previous app version)
    • Cover transformation of partial/incomplete alerts
    • These tests may partially overlap with UI tests (if rendering is correct, the state is valid)
  • Transformation tests (internal state → apiAlert):
    • Verify that the resulting shape is valid for API calls
    • Use backend documentation as a reference for defining “valid” shapes
    • Avoid real API calls — tests won’t depend on the network and will run faster, while still ensuring correctness
    • Anyways UI tests are using API calls (but maybe we can mock them too and increase test speed and stability)

@vekkele vekkele changed the base branch from master to next August 7, 2025 08:19
@vekkele vekkele force-pushed the feat/alert-dialog-tests branch from fa196f4 to 377f3c4 Compare August 22, 2025 12:29
@vekkele vekkele force-pushed the feat/alert-dialog-tests branch from 36ae804 to 17769cf Compare August 26, 2025 09:18
@vekkele vekkele marked this pull request as ready for review August 26, 2025 09:20
@vekkele vekkele requested a review from DmitriVanGuard August 26, 2025 09:20
@vekkele vekkele self-assigned this Aug 26, 2025
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.

2 participants