CL - Testing SnackbarHelper and ToastHelper #223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📋 PR Description
🎯 Purpose
This PR introduces comprehensive unit tests for
SnackbarHelperandToastHelper, ensuring that both components are fully covered under different scenarios. These tests enhance the reliability of critical user feedback mechanisms.✅ SnackbarHelper Test Coverage
📂 Tested Functions & Scenarios
showSnackbar- View AdditiontestShowSnackbarAddsViewToViewControllershowSnackbar- Auto DismisstestSnackbarDisappearsAfterDurationshowSnackbar- Fade-in & Fade-outtestSnackbarFadesInAndOutshowSnackbar- Text WrappingtestSnackbarHandlesLongTextshowSnackbar- Nil Description HandlingtestSnackbarHandlesNilDescription📄 SnackbarHelper Test Summary
✅ ToastHelper Test Coverage
📂 Tested Functions & Scenarios
showToast- View AdditiontestShowToastAddsViewToViewControllershowToast- Auto DismisstestToastDisappearsAfterDurationshowToast- Fade-in & Fade-outtestToastFadesInAndOutshowToast- Appearance ValidationToastType.testToastAppearanceMatchesTypeshowToast- Custom Type HandlingToastType.custom.testCustomToastType📄 ToastHelper Test Summary
ToastTypevariants.ToastType.customfully tested for icon, background, and text color.🌐 Why It Matters
These components (
SnackbarHelperandToastHelper) are critical for communicating system feedback to users. Ensuring they work reliably under various scenarios directly improves UX consistency and robustness. This test suite acts as:ToastTypeorSnackbarType).📊 Overall Test Summary
SnackbarHelperToastHelper🧰 Test Logging
LoggerHelperfor structured test logs.📌 Notes
layoutIfNeeded()to enforce layout pass.✅ Checklist
🛠 Steps to Test
This section explains how to manually verify the changes introduced in this PR.
Follow the steps below to ensure
SnackbarHelperandToastHelperare correctly tested and validated.1️⃣ Setup
SnackbarHelperTestsandToastHelperTestsare part of the active test target.XCTestNavigator(⌘ + 6) to view all test cases.2️⃣ Execute Tests
SnackbarHelperTestsToastHelperTests3️⃣ Review Logs (Optional)
LoggerHelper.4️⃣ Validate Results
LoggerHelper)5️⃣ Visual Verification (Extra)
Although these are unit tests, if you want to manually observe the actual
SnackbarandToastUI:SnackbarHelper.shared.showSnackbar()andToastHelper.shared.showToast()inside your app’s view controller.✅ Final Check
💻 Contributors
📷 Screenshots (Optional)