-
Notifications
You must be signed in to change notification settings - Fork 534
Unit tests for mutations #1783
Copy link
Copy link
Labels
frontendRelates to the project frontendRelates to the project frontendhelp wantedExtra attention is neededExtra attention is neededtypescriptRelates to TypeScript codeRelates to TypeScript code
Description
Terms
- I have searched open and closed issues
- I agree to follow activist's Code of Conduct
Issue
Summary
Implement comprehensive unit tests for mutation composables in folder frontend/app/composables/mutations.
Both use direct service calls and refresh Nuxt async/query data after mutations.
Requirements
- Test each mutation handler:
createFAQ,updateFAQ,reorderFAQs,deleteFAQ,uploadIconImage,refreshEventData, ext - Assert correct mutation behavior, service call invocations, state updates, and error propagation.
- Mock all underlying service calls and cache refresh (
refreshNuxtData). - Test error scenarios (service throws/returns error), check calls to
showToastErrorand the correct reactive error state. - Verify loading transitions (true/false states before/after mutation runs).
- Test edge cases: missing eventId or bad FAQ data, unexpected errors, handling for delete/add order, cache invalidation/refetch, ect
- Test that
refreshEventDataalways calls refreshNuxtData with the correct key after a mutation. - Cover reactivity (readonly states) for
loadinganderrorthroughout all mutation methods.
Paths & code references`
- Service helpers.
Implementation guidelines
- Use Vitest/Jest and Vue/Nuxt test utils to mock service/composable dependencies and async behaviors
- Place unit tests under
frontend/testst/composables/mutations - Document any additional edge cases, helpers, or mutation patterns discovered during implementation
- Link to parent and related subissues for review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
frontendRelates to the project frontendRelates to the project frontendhelp wantedExtra attention is neededExtra attention is neededtypescriptRelates to TypeScript codeRelates to TypeScript code
Type
Projects
Status
Done