Add tests for the stuff that's testable without requiring browser navigation. After opening the issue about testing official plugins from inside swup's main package, I thought it would be worth it to try it the other way around – testing right from the plugins themselves. After creating all these tests, I've become a fan of this approach.
Next up: playwright tests! 🤯🤪
It was very tempting to start with refactors right away during writing the tests 😅 ...in some cases, I couldn't resist. So now I need to go back to my playground and test out if it all still works as intended. Manual tests are still passing 🥳
Bonus
found a bug: Invalid selectors were not being discarded on initialization! It's already starting to pay off :)
@daun sorry for the huge PR, this is a review nightmare. But oh well, who cares really, as long as everything keeps working, right?
Todo
[x] add unit tests
[x] test if I've broken something in the process (manually, last time before we get playwright tests)
Checks
[x] The PR is submitted to the master branch
[x] The code was linted before pushing (npm run lint)
Description
Add tests for the stuff that's testable without requiring browser navigation. After opening the issue about testing official plugins from inside swup's main package, I thought it would be worth it to try it the other way around – testing right from the plugins themselves. After creating all these tests, I've become a fan of this approach.
Next up: playwright tests! 🤯🤪
It was very tempting to start with refactors right away during writing the tests 😅 ...in some cases, I couldn't resist.
So now I need to go back to my playground and test out if it all still works as intended.Manual tests are still passing 🥳Bonus found a bug: Invalid selectors were not being discarded on initialization! It's already starting to pay off :)
@daun sorry for the huge PR, this is a review nightmare. But oh well, who cares really, as long as everything keeps working, right?
Todo
Checks
master
branchnpm run lint
)npm run test
)