strapi / community-content

Contribute and collaborate on educational content for the Strapi Community
https://strapi.io/write-for-the-community
572 stars 402 forks source link

Unit Testing in React vite web applications with Jest and React Testing Library #1355

Open ArafatAbdussalam opened 5 months ago

ArafatAbdussalam commented 5 months ago

Content Brief:

What is your article idea?

This article entails the implementation of unit testing in React vite web applications. It discusses the meaning of unit testing, and how to write unit tests with Jest and React Testing Library. It explains how to use matchers and queries, test user interactions, asynchronous operations, and react-router web applications.

What are the objectives of your article?

Target audience: Web application developers, individuals involved in testing react web applications

Keywords: web development, unit testing, react, react-router, spa

Content objective:

This tutorial aims to teach web application developers how to write unit tests in their React Vite web applications. It further explains how to test user interactions, asynchronous functions and, react-router single-page applications.

Content Outline:

What is your expertise as a developer or writer?

Intermediate

What type of post is this?

Tutorial

Terms & Conditions

ArafatAbdussalam commented 5 months ago

Hello @Theodore-Kelechukwu-Onyejiaku I would be glad if you could check this proposed article.

Theodore-Kelechukwu-Onyejiaku commented 5 months ago

Hi @ArafatAbdussalam,

Thank you for your outline. It appears that this article will primarily cover plain React. Nonetheless, we would prefer if it could be about NextJs. Kindly share your thoughts on this.

ArafatAbdussalam commented 5 months ago

Alright. That is cool. I will proceed with the content online on Unit Testing in NextJs (JavaScript) with Jest and React Testing Library.

ArafatAbdussalam commented 5 months ago

Here it is @Theodore-Kelechukwu-Onyejiaku

Theodore-Kelechukwu-Onyejiaku commented 5 months ago

Hi @ArafatAbdussalam ,

Thanks for the updated outline. It seems you are missing the vite part of the topic. Can you also include Vitest, along with Jest for Unit Testing and perhaps a little on E2E tests, since Vitest can't run async components (server components) but synchronous server components.

I would also suggest building a project and implementing the testing using the different testing tools. This might be an intermediate tutorial depending on the outcome of your draft.

Please let me know what you think.

ArafatAbdussalam commented 5 months ago

Unit Testing and End-to-End Testing in NextJs (JavaScript) with Vitest, Jest, and React Testing Library

ArafatAbdussalam commented 5 months ago

Hi @Theodore-Kelechukwu-Onyejiaku The content outline has been updated

Theodore-Kelechukwu-Onyejiaku commented 5 months ago

Hi @ArafatAbdussalam ,

Please go ahead. Thank you!

ArafatAbdussalam commented 5 months ago

Alright.

Theodore-Kelechukwu-Onyejiaku commented 3 months ago

Hi @ArafatAbdussalam ,

Please what is the status of this work?

Theodore-Kelechukwu-Onyejiaku commented 1 month ago

Hi @ArafatAbdussalam ,

I hope you are doing fine. Please, what is the status of this draft?

ArafatAbdussalam commented 3 weeks ago

Hi @Theodore-Kelechukwu-Onyejiaku I am doing well and fine. This is the article I talked about as regards the glitch I was experiencing.

I will commence working on it now.

Theodore-Kelechukwu-Onyejiaku commented 1 week ago

Hi @ArafatAbdussalam ,

Thanks for your contribution. Please may I know the status of this article?

ArafatAbdussalam commented 3 days ago

Hi @Theodore-Kelechukwu-Onyejiaku I have already started working on it. I switched to using Vitest, React Testing Library and playwright. Vitest is faster than Jest and can be integrated easily with other Testing framework.