Mock Screen Wake Lock API (
navigator.wakeLock
) with ease and run your tests using Jest
🏠 Homepage
Prerequisites
Install
npm i -D jest-wake-lock-mock
# or
yarn add -D jest-wake-lock-mock
Usage
In your jest.config.js
or package.json
under jest
section create a setupFiles
array and add jest-wake-lock-mock
to it.
{
setupFiles: ['jest-wake-lock-mock'],
// jest config...
}
Tests
Write your tests with confidence using the same Screen Wake Lock API api as in the browser.
Example (More):
const requestWakeLock = async () => {
try {
const wakeLock = await navigator.wakeLock.request('screen');
return { wakeLock };
} catch (error) {
return { error };
}
};
test('wakeLock request with success', async () => {
const { wakeLock, error } = await requestWakeLock(handleRelease);
expect(error).not.toBeDefined();
expect(wakeLock).toBeDefined();
expect(wakeLock?.type).toEqual('screen');
expect(wakeLock?.released).toBe(false);
});
Author
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a
📝 License
Copyright © 2020 Joris.
This project is MIT licensed.
This README was generated with
very appropriate
I enjoy reading an article that will make men and women think. Also, thank you for permitting me to comment. April Guilbert Shae
This is one awesome article post. Really looking forward to read more. Keep writing. Geneva Jarred Emmalee
Thank you and bless you, my friend. We are hearing and singing the same song. The Mother is growing stronger now and guides our hearts. Maddy Erhard Addi
I consider something really special in this website. Jeanine Finley Schatz
This design is spectacular! You obviously know how to keep a reader entertained. Karolina Thebault Boycie
Currently it looks like WordPress is the preferred blogging platform available right now. Sarette Bartolomeo Beaver
You made some good points there. I did a search on the issue and found most individuals will go along with with your blog. Janette Mischa Diarmuid
Absolutely! Matt will be the first, well second, to know when copies arrive. Should be in two to three weeks. Dory Brok Shetrit
Really informative blog article. Really thank you! Want more. Zilvia Godfrey Shadow
Very good post! We will be linking to this great content on our site. Inga Dalis Ambrosi
Wonderful experience. We enlisted their services to assist us in getting the license for our hotel. Tootsie Demott Bucher
This is one awesome blog post. Much thanks again. Much obliged. Violette Kev Cima
Great article. I am facing some of these issues as well.. Guinevere Sig Ab
Right here is the right website for anybody who wishes to understand this topic. Brenda Darn Sherlock
You can build your own portfolio details page using the page builder. Nadean Jamil Jana
Pretty! This has been a really wonderful article. Many thanks for providing this information. Rakel Schuyler Cyb
Thanks again for the blog post. Really looking forward to read more. Great. Sherry Rice Falconer
I typically only use stock themes. It was something I slapped together in less then an hour. WordPress is good for such things. Madlin Elijah Heidie
Very interesting details you have mentioned, regards for putting up. Anabelle Arney Iy
Hi there, this weekend is nice in support of me, since this point in time i am reading this wonderful informative article here at my house. Sigrid Kalil Richela
What a material of un-ambiguity and preserveness of precious familiarity regarding unexpected feelings. Genny Maddie Smalley
Wow, great post. Really looking forward to read more. Great. Debora Dani Annette
Merely wanna state that this really is really helpful , Thanks for taking your time to write this. Melany Worthy Adamson
Thanks a lot for the blog post. Much thanks again. Really Cool. Felipa Benyamin Atalaya
I really like this. It has been a while since I have posted a new Haibun Thinking due to time restraints. Claudine Thornton Venita
I absolutely love your site.. Pleasant colors & theme. Mable Jess Abran
Keep up the superb work , I read few articles on this site and I think that your website is real interesting and has sets of good information. Kaye Andras Cahra
Amazing! Its in fact remarkable paragraph, I have got much clear idea on the topic of from this article. Letty Mendie Tallie
Very interesting details you have noted, thanks for posting. Brena Jory Standley
Will u masturbate in these months?or is it dangerous.. Terese Hillel Cinelli
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site.
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
I precisely desired to say thanks again. I’m not certain the things I could possibly have created in the absence of the actual creative concepts discussed by you concerning my concern. It absolutely was a depressing concern for me personally, but considering a new professional fashion you handled it forced me to cry for delight. I’m grateful for the assistance and as well , expect you comprehend what a powerful job that you are carrying out educating men and women by way of a web site. I am certain you’ve never come across all of us.