DisconnectWhatsApp
Overview
This document outlines the test cases for the DisconnectWhatsApp
component. The DisconnectWhatsApp
component allows users to disconnect their WhatsApp account from the Lunchbox application. These test cases ensure that the component behaves as expected under different conditions.
Test Case 1: Rendering the Component
- Description: Tests the initial rendering of the
DisconnectWhatsApp
modal. - Expected Outcome: The modal should render correctly with the appropriate text and buttons. The modal should contain elements with the following test IDs:
disconnect-whatsapp-modal
cancel-button
continue-button
- The modal should also display the text: "Are you sure you want to disconnect WhatsApp?".
Test Case 2: Handling Cancel Button Click
- Description: Tests the behavior when the 'Cancel' button is clicked.
- Expected Outcome: The
modals.closeAll
function should be called to close the modal.
Test Case 3: Handling Continue Button Click
- Description: Tests the behavior when the 'Continue' button is clicked.
- Expected Outcome: The
mutateAsync
function should be called with{ phone: null }
to update the user profile, and themodals.closeAll
function should be called to close the modal after the profile update is successful.
Test Case 4: Disabling Buttons When isPending is True
- Description: Tests the behavior when
isPending
is true (indicating an ongoing profile update). - Expected Outcome: Both the 'Cancel' and 'Continue' buttons should be disabled when
isPending
is true.