princefishthrower / react-use-please-stay

A React hook that animates the document title and/or favicon when focus from the page is lost.
MIT License
152 stars 7 forks source link

Add Automated Tests #3

Open princefishthrower opened 3 years ago

princefishthrower commented 3 years ago

Other than doing some smoke tests via the interactive demo site, I have no other testing method currently for the code in this repo 😅

I'm partial to end-to-end testing tools for a project like this (like cypress for example) because our tests can truly observe the changes in document.title and the <link rel="..."> values.

I'm looking for the following:

This PR could potentially expand into multiple PRs - setting up tests first locally, then adding it to a CI / CD process (which also doesn't exist yet 😅 ) etc. etc.

wsameer commented 3 years ago

Adding unit tests gives you better sleep. Also they can be integrated into the CI/CD pipe-line too.

princefishthrower commented 3 years ago

@wsameer sounds good. Do you have a preferred library in mind? (Ideally, one that works well with React + TypeScript)

wsameer commented 3 years ago

@wsameer sounds good. Do you have a preferred library in mind? (Ideally, one that works well with React + TypeScript) My go-to combo is always JEST + Testing Library

princefishthrower commented 3 years ago

@wsameer - sounds good to me. Do you want to take this one?

AbhimanyuBahree commented 3 years ago

I could give JEST testing library a shot. Will PR if successfull.

princefishthrower commented 3 years ago

@babu1998 - any update here?