solid-toast
solid-toast copied to clipboard
Add Tests For Solid Toast
There are multiple combinations of ways to use/configure solid-toast. We need to add tests to make sure the configuration follows the correct hierarchy and manages edge cases correctly.
Do you refer to unit tests (for certain functions....), or end-2-end tests for the full functionality ? is jest / cypress what you're looking for respectively.
Apologies for the late reply. Been talking a break from some of the projects this week. I believe my concern recently has been while making changes/updates to the core API, I want to make sure that backwards compatibility is correctly preserved.
The current pain points that I can recognise right now is that solid-toast allows users to define the default behaviour of the toasts by passing props to the Toaster component. These default configuration should still be overridden by the call-site toast function. For example,
// Toaster config setting all toasts to have a default duration of 3secs
<Toaster
toastOptions={{
duration: 3000
}}
/>
// Call-Site toast invocation that overrides the 3 seconds default
toast('Hello, World', {
duration: 6000
})
Along with this. Different toast types have different default durations if nothing is configured https://github.com/ardeora/solid-toast/blob/main/src/core/defaults.ts#L4-L10. These defaults should only be applied if the Toaster Component/toast function do not provide any duration.
So as per priority goes. Having Jest unit tests that test different edge cases and configuration permutations would be a first good step for making the library resilient to most common source of bugs. End-To-End tests would be awesome to have but that is something that can be put in the nice-to-haves list. Hope this answers your question :D
Thank you, yes it does, I haven't checked the full codebase yet since I wasn't sure I'll be working on this, tomorrow i'll start and whenever i'm done, i'll send a pull-request.