Here are 2 blog posts with an accompanying code example that I wrote which shows how I would start writing a component library and how to test stuff in modern web apps:
https://dev.to/denniskortsch/build-test-and-release-a-react-component-library-with-storybook-13d6 https://dev.to/denniskortsch/develop-and-test-react-apps-with-react-query-msw-and-react-testing-library-1n7e